pandas.PeriodIndex.asfreq
-
PeriodIndex.asfreq(*args, **kwargs)[source] -
Преобразовать массив/индекс Period в указанную частоту
freq.Параметры: -
freq : str -
частота
-
how : str {‘E’, ‘S’} -
‘E’, ‘END’, или ‘FINISH’ для конца, ‘S’, ‘START’, или ‘BEGIN’ для начала. Нужно ли выравнивать элементы к концу или началу периода. Например, 31 января (‘END’) против 1 января (‘START’).
Возвращает: -
new : Period Array/Index with the new frequency
Примеры
>>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A') >>> pidx <class 'pandas.core.indexes.period.PeriodIndex'> [2010, ..., 2015] Length: 6, Freq: A-DEC>>> pidx.asfreq('M') <class 'pandas.core.indexes.period.PeriodIndex'> [2010-12, ..., 2015-12] Length: 6, Freq: M>>> pidx.asfreq('M', how='S') <class 'pandas.core.indexes.period.PeriodIndex'> [2010-01, ..., 2015-01] Length: 6, Freq: M -
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.PeriodIndex.asfreq.html