pandas.Series.dt.freq#
- Series.dt.freq[source]#
Tries to return a string representing a frequency generated by infer_freq.
Returns None if it can’t autodetect the frequency.
See also
Series.dt.to_period
Cast to PeriodArray/PeriodIndex at a particular frequency.
Examples
>>> ser = pd.Series(["2024-01-01", "2024-01-02", "2024-01-03", "2024-01-04"]) >>> ser = pd.to_datetime(ser) >>> ser.dt.freq 'D'
>>> ser = pd.Series(["2022-01-01", "2024-01-01", "2026-01-01", "2028-01-01"]) >>> ser = pd.to_datetime(ser) >>> ser.dt.freq '2YS-JAN'