pandas.
PeriodIndex
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.
Timezone for converting datetime64 data to Periods.
See also
Index
The base pandas Index type.
Period
Represents a period of time.
DatetimeIndex
Index with datetime64 data.
TimedeltaIndex
Index of timedelta64 data.
period_range
Create a fixed-frequency PeriodIndex.
Examples
>>> idx = pd.PeriodIndex(year=[2000, 2002], quarter=[1, 3]) >>> idx PeriodIndex(['2000Q1', '2002Q3'], dtype='period[Q-DEC]', freq='Q-DEC')
Attributes
day
The days of the period.
dayofweek
The day of the week with Monday=0, Sunday=6.
day_of_week
dayofyear
The ordinal day of the year.
day_of_year
days_in_month
The number of days in the month.
daysinmonth
freq
Return the frequency object if it is set, otherwise None.
freqstr
Return the frequency object as a string if its set, otherwise None.
hour
The hour of the period.
is_leap_year
Logical indicating if the date belongs to a leap year.
minute
The minute of the period.
month
The month as January=1, December=12.
quarter
The quarter of the date.
second
The second of the period.
week
The week ordinal of the year.
weekday
weekofyear
year
The year of the period.
end_time
qyear
start_time
Methods
asfreq([freq, how])
asfreq
Convert the Period Array/Index to the specified frequency freq.
strftime(*args, **kwargs)
strftime
Convert to Index using specified date_format.
to_timestamp([freq, how])
to_timestamp
Cast to DatetimeArray/Index.