pandas.arrays.PeriodArray
-
class pandas.arrays.PeriodArray(values, freq=None, dtype=None, copy=False)[source] -
Pandas ExtensionArray for storing Period data.
Users should use
period_array()to create new instances.Parameters: -
values : Union[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).
-
freq : str or DateOffset -
The
freqto use for the array. Mostly applicable whenvaluesis an ndarray of integers, whenfreqis required. Whenvaluesis a PeriodArray (or box around), it’s checked thatvalues.freqmatchesfreq. -
dtype : PeriodDtype, optional -
A PeriodDtype instance from which to extract a
freq. If bothfreqanddtypeare specified, then the frequencies must match. -
copy : bool, default False -
Whether to copy the ordinals before storing.
See also
-
period_array - Create a new PeriodArray.
-
PeriodIndex - Immutable Index for period data.
Notes
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
freqindicates the span covered by each element of the array. All elements in the PeriodArray have the samefreq.Attributes
None Methods
None -
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.arrays.PeriodArray.html