PeriodArray(values, dtype=None, freq=None, copy=False)¶
Pandas ExtensionArray for storing Period data.
Users should use
period_array()to create new instances. Alternatively,
array()can be used to create new instances from a sequence of Period scalars.
- valuesUnion[PeriodArray, Series[period], ndarray[int], PeriodIndex]
The data to store. These should be arrays that can be directly converted to ordinals without inference or copy (PeriodArray, ndarray[int64]), or a box around such an array (Series[period], PeriodIndex).
- dtypePeriodDtype, optional
A PeriodDtype instance from which to extract a freq. If both freq and dtype are specified, then the frequencies must match.
- freqstr or DateOffset
The freq to use for the array. Mostly applicable when values is an ndarray of integers, when freq is required. When values is a PeriodArray (or box around), it’s checked that
- copybool, default False
Whether to copy the ordinals before storing.
Represents a period of time.
Immutable Index for period data.
Create a fixed-frequency PeriodArray.
Construct a pandas array.
There are two components to a PeriodArray
ordinals : integer ndarray
freq : pd.tseries.offsets.Offset
The values are physically stored as a 1-D ndarray of integers. These are called “ordinals” and represent some kind of offset from a base.
The freq indicates the span covered by each element of the array. All elements in the PeriodArray have the same freq.