pandas.PeriodIndex.from_ordinals#

classmethod PeriodIndex.from_ordinals(ordinals, *, freq, name=None)[source]#

Construct a PeriodIndex from ordinals.

Parameters:
ordinalsarray-like of int

The period offsets from the proleptic Gregorian epoch.

freqstr or period object

One of pandas period strings or corresponding objects.

namestr, default None

Name of the resulting PeriodIndex.

Returns:
PeriodIndex

Examples

>>> idx = pd.PeriodIndex.from_ordinals([-1, 0, 1], freq="Q")
>>> idx
PeriodIndex(['1969Q4', '1970Q1', '1970Q2'], dtype='period[Q-DEC]')