File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -355,6 +355,44 @@ 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+ Whether the elements should be aligned to the end
370+ or start within pa period. January 31st ('END') vs.
371+ Janury 1st ('START') for example.
372+
373+ Returns
374+ -------
375+
376+ new : PeriodIndex with the new frequency
377+
378+ Examples
379+ --------
380+ >>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A')
381+ >>> pidx
382+ <class 'pandas.tseries.period.PeriodIndex'>
383+ [2010, ..., 2015]
384+ Length: 6, Freq: A-DEC
385+
386+ >>> pidx.asfreq('M')
387+ <class 'pandas.tseries.period.PeriodIndex'>
388+ [2010-12, ..., 2015-12]
389+ Length: 6, Freq: M
390+
391+ >>> pidx.asfreq('M', how='S')
392+ <class 'pandas.tseries.period.PeriodIndex'>
393+ [2010-01, ..., 2015-01]
394+ Length: 6, Freq: M
395+ """
358396 how = _validate_end_alias (how )
359397
360398 freq = frequencies .get_standard_freq (freq )
You can’t perform that action at this time.
0 commit comments