Skip to content

Commit c147151

Browse files
committed
DOC: add PeriodIndex.asfreq docstring
1 parent 4b58538 commit c147151

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

pandas/tseries/period.py

+30
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,36 @@ 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; a frequency
365+
how: str; {'E', 'S'}
366+
'E', 'END', or 'FINISH' for end,
367+
'S', 'START', or 'BEGIN' for start.
368+
369+
Returns
370+
=======
371+
new: PeriodIndex with the new frequency
372+
373+
Examples
374+
========
375+
376+
>>> pidx = pd.datejjk
377+
>>> pidx.asfreq('M')
378+
<class 'pandas.tseries.period.PeriodIndex'>
379+
[2010-12, ..., 2015-12]
380+
Length: 6, Freq: M
381+
382+
>>> pidx.asfreq('M', how='S')
383+
Out[3]:
384+
<class 'pandas.tseries.period.PeriodIndex'>
385+
[2010-01, ..., 2015-01]
386+
Length: 6, Freq: M
387+
"""
358388
how = _validate_end_alias(how)
359389

360390
freq = frequencies.get_standard_freq(freq)

0 commit comments

Comments
 (0)