Skip to content

Commit 284092f

Browse files
committed
Added an example for infer_freq
Added an example for infer_freq function. The initial index is built using a fixed number of periods to avoid encoding frequency in this index explicitly.
1 parent 5794002 commit 284092f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tseries/frequencies.py

+7
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,13 @@ def infer_freq(index, warn: bool = True) -> Optional[str]:
145145
If the index is not datetime-like.
146146
ValueError
147147
If there are fewer than three values.
148+
149+
Examples
150+
--------
151+
>>> idx = pd.date_range(start = '2020/12/01', end = '2020/12/30', periods = 30)
152+
>>> pd.infer_freq(idx)
153+
'D'
154+
148155
"""
149156
import pandas as pd
150157

0 commit comments

Comments
 (0)