pandas.TimedeltaIndex.inferred_freq#

TimedeltaIndex.inferred_freq[source]#

Tries to return a string representing a frequency generated by infer_freq.

Returns None if it can’t autodetect the frequency.

Examples

For DatetimeIndex:

>>> idx = pd.DatetimeIndex(["2018-01-01", "2018-01-03", "2018-01-05"])
>>> idx.inferred_freq
'2D'

For TimedeltaIndex:

>>> tdelta_idx = pd.to_timedelta(["0 days", "10 days", "20 days"])
>>> tdelta_idx
TimedeltaIndex(['0 days', '10 days', '20 days'],
               dtype='timedelta64[ns]', freq=None)
>>> tdelta_idx.inferred_freq
'10D'