- API reference
- pandas.PeriodIndex
- pandas.Perio...
pandas.PeriodIndex.days_in_month#
- propertyPeriodIndex.days_in_month[source]#
The number of days in the month.
Examples
For Series:
>>>period=pd.period_range('2020-1-1 00:00','2020-3-1 00:00',freq='M')>>>s=pd.Series(period)>>>s0 2020-011 2020-022 2020-03dtype: period[M]>>>s.dt.days_in_month0 311 292 31dtype: int64
For PeriodIndex:
>>>idx=pd.PeriodIndex(["2023-01","2023-02","2023-03"],freq="M")>>>idx.days_in_month# It can be also entered as `daysinmonth`Index([31, 28, 31], dtype='int64')
On this page