class_docstr: Pandas ExtensionArray for storing Period data.
  
  Users should use :func:`~pandas.period_array` to create new instances.
  Alternatively, :func:`~pandas.array` can be used to create new instances
  from a sequence of Period scalars.
  
  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).
  dtype : PeriodDtype, optional
      A PeriodDtype instance from which to extract a `freq`. If both
      `freq` and `dtype` are specified, then the frequencies must match.
  freq : str 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 ``values.freq``
      matches `freq`.
  copy : bool, default False
      Whether to copy the ordinals before storing.
  
  Attributes
  ----------
  None
  
  Methods
  -------
  None
  
  See Also
  --------
  Period: Represents a period of time.
  PeriodIndex : Immutable Index for period data.
  period_range: Create a fixed-frequency PeriodArray.
  array: Construct a pandas array.
  
  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 `freq` indicates the span covered by each element of the array.
  All elements in the PeriodArray have the same `freq`.
class_docstr_tok: ["Pandas","ExtensionArray","for","storing","Period","data",".","Users","should","use",":","func",":","`","~pandas.period_array","`","to","create","new","instances",".","Alternatively",",",":","func",":","`","~pandas.array","`","can","be","used","to","create","new","instances","from","a","sequence","of","Period","scalars",".","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",")",".","dtype",":","PeriodDtype",",","optional","A","PeriodDtype","instance","from","which","to","extract","a","`","freq","`",".","If","both","`","freq","`","and","`","dtype","`","are","specified",",","then","the","frequencies","must","match",".","freq",":","str","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","``","values.freq","``","matches","`","freq","`",".","copy",":","bool",",","default","False","Whether","to","copy","the","ordinals","before","storing",".","Attributes","--","--","--","--","--","None","Methods","--","--","--","-","None","See","Also","--","--","--","--","Period",":","Represents","a","period","of","time",".","PeriodIndex",":","Immutable","Index","for","period","data",".","period_range",":","Create","a","fixed-frequency","PeriodArray",".","array",":","Construct","a","pandas","array",".","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","`","freq","`","indicates","the","span","covered","by","each","element","of","the","array",".","All","elements","in","the","PeriodArray","have","the","same","`","freq","`","."]
docstr: Convert the {klass} to the specified frequency `freq`.
  
  Equivalent to applying :meth:`pandas.Period.asfreq` with the given arguments
  to each :class:`~pandas.Period` in this {klass}.
  
  Parameters
  ----------
  freq : str
      A frequency.
  how : str {{'E', 'S'}}, default 'E'
      Whether the elements should be aligned to the end
      or start within pa period.
  
      * 'E', 'END', or 'FINISH' for end,
      * 'S', 'START', or 'BEGIN' for start.
  
      January 31st ('END') vs. January 1st ('START') for example.
  
  Returns
  -------
  {klass}
      The transformed {klass} with the new frequency.
  
  See Also
  --------
  {other}.asfreq: Convert each Period in a {other_name} to the given frequency.
  Period.asfreq : Convert a :class:`~pandas.Period` object to the given frequency.
  
  Examples
  --------
  >>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A')
  >>> pidx
  PeriodIndex(['2010', '2011', '2012', '2013', '2014', '2015'],
  dtype='period[A-DEC]')
  
  >>> pidx.asfreq('M')
  PeriodIndex(['2010-12', '2011-12', '2012-12', '2013-12', '2014-12',
  '2015-12'], dtype='period[M]')
  
  >>> pidx.asfreq('M', how='S')
  PeriodIndex(['2010-01', '2011-01', '2012-01', '2013-01', '2014-01',
  '2015-01'], dtype='period[M]')
code: def asfreq(self, freq=None, how: str = "E") -> PeriodArray:
      """
      Convert the {klass} to the specified frequency `freq`.
  
      Equivalent to applying :meth:`pandas.Period.asfreq` with the given arguments
      to each :class:`~pandas.Period` in this {klass}.
  
      Parameters
      ----------
      freq : str
          A frequency.
      how : str {{'E', 'S'}}, default 'E'
          Whether the elements should be aligned to the end
          or start within pa period.
  
          * 'E', 'END', or 'FINISH' for end,
          * 'S', 'START', or 'BEGIN' for start.
  
          January 31st ('END') vs. January 1st ('START') for example.
  
      Returns
      -------
      {klass}
          The transformed {klass} with the new frequency.
  
      See Also
      --------
      {other}.asfreq: Convert each Period in a {other_name} to the given frequency.
      Period.asfreq : Convert a :class:`~pandas.Period` object to the given frequency.
  
      Examples
      --------
      >>> pidx = pd.period_range('2010-01-01', '2015-01-01', freq='A')
      >>> pidx
      PeriodIndex(['2010', '2011', '2012', '2013', '2014', '2015'],
      dtype='period[A-DEC]')
  
      >>> pidx.asfreq('M')
      PeriodIndex(['2010-12', '2011-12', '2012-12', '2013-12', '2014-12',
      '2015-12'], dtype='period[M]')
  
      >>> pidx.asfreq('M', how='S')
      PeriodIndex(['2010-01', '2011-01', '2012-01', '2013-01', '2014-01',
      '2015-01'], dtype='period[M]')
      """
      how = libperiod.validate_end_alias(how)
  
      freq = Period._maybe_convert_freq(freq)
  
      base1 = self._dtype._dtype_code
      base2 = freq._period_dtype_code
  
      asi8 = self.asi8
      # self.freq.n can't be negative or 0
      end = how == "E"
      if end:
          ordinal = asi8 + self.freq.n - 1
      else:
          ordinal = asi8
  
      new_data = period_asfreq_arr(ordinal, base1, base2, end)
  
      if self._hasna:
          new_data[self._isnan] = iNaT
  
      return type(self)(new_data, freq=freq)
  
imports: from __future__ import annotations
  from datetime import timedelta
  import operator
  from typing import TYPE_CHECKING, Any, Callable, Literal, Sequence, TypeVar, overload
  import numpy
  from pandas._libs import algos, lib
  from pandas._libs.arrays import NDArrayBacked
  from pandas._libs.tslibs import BaseOffset, NaT, NaTType, Timedelta, astype_overflowsafe, dt64arr_to_periodarr, get_unit_from_dtype, iNaT, parsing, period, to_offset
  from pandas._libs.tslibs.dtypes import FreqGroup
  from pandas._libs.tslibs.fields import isleapyear_arr
  from pandas._libs.tslibs.offsets import Tick, delta_to_tick
  from pandas._libs.tslibs.period import DIFFERENT_FREQ, IncompatibleFrequency, Period, get_period_field_arr, period_asfreq_arr
  from pandas._typing import AnyArrayLike, Dtype, NpDtype, npt
  from pandas.util._decorators import cache_readonly, doc
  from pandas.core.dtypes.common import ensure_object, is_datetime64_any_dtype, is_datetime64_dtype, is_dtype_equal, is_float_dtype, is_integer_dtype, is_period_dtype, pandas_dtype
  from pandas.core.dtypes.dtypes import PeriodDtype
  from pandas.core.dtypes.generic import ABCIndex, ABCPeriodIndex, ABCSeries, ABCTimedeltaArray
  from pandas.core.dtypes.missing import isna
  import pandas.core.algorithms
  from pandas.core.arrays import datetimelike
  import pandas.core.common
label_desc: Use image node_id 18 for calling the PeriodArray obj's underlying member method code with example usage: obj.asfreq(freq, how) and returns: type