TimeSeriesDataFrame.infer_frequency

TimeSeriesDataFrame.infer_frequency(num_items: int | None = 100, raise_if_irregular: bool = False) str[source]

Infer the time series frequency based on the timestamps of the observations.

Parameters:
  • num_items (int or None, default = 100) –

    Number of items (individual time series) randomly selected to infer the frequency. Lower values speed up the method, but increase the chance that some items with invalid frequency are missed by subsampling.

    If set to None, all items will be used for inferring the frequency.

  • raise_if_irregular (bool, default = False) – If True, an exception will be raised if some items have an irregular frequency, or if different items have different frequencies.

Returns:

freq – If all time series have a regular frequency, returns a pandas-compatible frequency alias.

If some items have an irregular frequency or if different items have different frequencies, returns string IRREG.

Return type:

str