Skip to main content
`Ctrl`+`K`

# pandas.PeriodIndex.from_ordinals

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

  Construct a PeriodIndex from ordinals.

  Parameters:
    ordinals array-like of int

      The period offsets from the proleptic Gregorian epoch.

    freq str or period object

      One of pandas period strings or corresponding objects.

    name str, default None

      Name of the resulting PeriodIndex.

  Returns:
    PeriodIndex

  See also

  `PeriodIndex.from_fields`

    Construct a PeriodIndex from fields (year, month, day, etc.).

  `PeriodIndex.to_timestamp`

    Cast to DatetimeArray/Index.

  Examples

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