Immutable ndarray holding ordinal values indicating regular periods in time.
Index keys are boxed to Period objects which carries the metadata (eg, frequency information).
Optional period-like data to construct index with.
Make a copy of input ndarray.
One of pandas period strings or corresponding objects.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Deprecated since version 2.2.0: Use PeriodIndex.from_fields instead.
Attributes
The days of the period. | |
The day of the week with Monday=0, Sunday=6. | |
The day of the week with Monday=0, Sunday=6. | |
The ordinal day of the year. | |
The ordinal day of the year. | |
The number of days in the month. | |
The number of days in the month. | |
Get the Timestamp for the end of the period. | |
Return the frequency object as a string if it's set, otherwise None. | |
The hour of the period. | |
Logical indicating if the date belongs to a leap year. | |
The minute of the period. | |
The month as January=1, December=12. | |
The quarter of the date. | |
The second of the period. | |
Get the Timestamp for the start of the period. | |
The week ordinal of the year. | |
The day of the week with Monday=0, Sunday=6. | |
The week ordinal of the year. | |
The year of the period. |
freq | |
qyear |
Methods
| Convert the PeriodArray to the specified frequency freq. |
| Convert to Index using specified date_format. |
| Cast to DatetimeArray/Index. |
from_fields | |
from_ordinals |
See also
IndexThe base pandas Index type.
PeriodRepresents a period of time.
DatetimeIndexIndex with datetime64 data.
TimedeltaIndexIndex of timedelta64 data.
period_rangeCreate a fixed-frequency PeriodIndex.
Examples
>>> idx = pd.PeriodIndex.from_fields(year=[2000, 2002], quarter=[1, 3])
>>> idx
PeriodIndex(['2000Q1', '2002Q3'], dtype='period[Q-DEC]')
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.PeriodIndex.html