pandas.PeriodIndex.from_ordinals

pandas 3.1.1 · Index objects · method

Build a PeriodIndex from integer period offsets at the selected frequency.

Call syntax

PeriodIndex.from_ordinals(ordinals, *, freq, name=None)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
ordinals Required
Positional or keyword
array-like of int
freq Required
Keyword only
str or period object

Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start.

name Optional
Keyword only
Default None
str

Set a name or identify the named object used by the operation.

Returns

PeriodIndex