infer_frequency#
- pymc_marketing.mmm.utils.infer_frequency(dates)[source]#
Return the frequency pandas infers for
dates, as a string.It is the string
pandas.infer_freq()returns. pandas 3.1 deprecates that string result in favor of an offset and warns on every call, so the frequency is read from aDatetimeIndexbuilt withfreq="infer", whosefreqis an offset on every pandas version. No global option or warning filter is touched, so concurrent calls are safe.- Parameters:
dates (array_like of
datetime) – The dates to infer the frequency of.- Return type:
- Returns:
The frequency string, such as
"W-MON", orNonewhen pandas cannot infer one.- Raises:
ValueError – If there are fewer than three dates, as
pandas.infer_freq()raises.