pandas.PeriodIndex.asfreq
-
PeriodIndex.asfreq(self, *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 PeriodIndex(['2010', '2011', '2012', '2013', '2014', '2015'], dtype='period[A-DEC]', freq='A-DEC')>>> pidx.asfreq('M') PeriodIndex(['2010-12', '2011-12', '2012-12', '2013-12', '2014-12', '2015-12'], dtype='period[M]', freq='M')>>> pidx.asfreq('M', how='S') PeriodIndex(['2010-01', '2011-01', '2012-01', '2013-01', '2014-01', '2015-01'], dtype='period[M]', 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.25.0/reference/api/pandas.PeriodIndex.asfreq.html