Skip to content

Commit 961fc1b

Browse files
authored
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 4f271f0 commit 961fc1b

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
@@ -139,6 +139,13 @@ def infer_freq(index, warn: bool = True) -> Optional[str]:
139139
If the index is not datetime-like.
140140
ValueError
141141
If there are fewer than three values.
142+
143+
Examples
144+
--------
145+
>>> idx = pd.date_range(start = '2020/12/01', end = '2020/12/30', periods = 30)
146+
>>> pd.infer_freq(idx)
147+
'D'
148+
142149
"""
143150
import pandas as pd
144151

0 commit comments

Comments
 (0)