File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,37 @@ def freqstr(self):
355355 return self .freq
356356
357357 def asfreq (self , freq = None , how = 'E' ):
358+ """
359+ Convert the PeriodIndex to the specified frequency `freq`.
360+
361+ Parameters
362+ ----------
363+
364+ freq : str
365+ a frequency
366+ how : str {'E', 'S'}
367+ 'E', 'END', or 'FINISH' for end,
368+ 'S', 'START', or 'BEGIN' for start.
369+
370+ Returns
371+ -------
372+
373+ new: PeriodIndex with the new frequency
374+
375+ Examples
376+ --------
377+
378+ >>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A')
379+ >>> pidx.asfreq('M')
380+ <class 'pandas.tseries.period.PeriodIndex'>
381+ [2010-12, ..., 2015-12]
382+ Length: 6, Freq: M
383+
384+ >>> pidx.asfreq('M', how='S')
385+ <class 'pandas.tseries.period.PeriodIndex'>
386+ [2010-01, ..., 2015-01]
387+ Length: 6, Freq: M
388+ """
358389 how = _validate_end_alias (how )
359390
360391 freq = frequencies .get_standard_freq (freq )
You can’t perform that action at this time.
0 commit comments