
    Mh4                       S SK Jr  S SKJr  S SKrS SKJrJrJrJ	r	J
r
JrJr  S SKrS SKrS SKJrJr  S SKJr  S SKJrJrJrJrJrJrJrJrJ r J!r!J"r#J$r$  S SK%J&r&J'r'J(r(  S S	K)J*r*  S S
K+J,r,J-r-  S SK.J/r/J0r0J1r1J2r2J3r3  S SK4J5r5J6r6  S SK7J8r8  S SK9J:r:J;r;  S SK<J=r=J>r>  S SK?J@r@JArAJBrBJCrC  S SKDJErE  S SKFJGrH  S SKIJJs  JKrL  \(       a(  S SKMJNrN  S SKOJPrPJQrQJRrRJSrSJTrTJUrUJVrVJWrW  S SKFJXrXJYrY  S SKZJ[r[  \
" S\S9r\SS0r]S&S'S jjr^ " S S\HR                  \#R                  5      raS(S jrb  S)       S*S jjrc\S+S j5       rd\S,S  j5       rd    S-S! jrd S& S.S" jjrS/S0S# jjre        S1 S2S$ jjrfS3S% jrgg)4    )annotations)	timedeltaN)TYPE_CHECKINGAnyCallableLiteralTypeVarcastoverload)algoslib)NDArrayBacked)
BaseOffsetNaTNaTType	Timedeltaadd_overflowsafeastype_overflowsafedt64arr_to_periodarrget_unit_from_dtypeiNaTparsingperiod	to_offset)	FreqGroupPeriodDtypeBasefreq_to_period_freqstr)isleapyear_arr)Tickdelta_to_tick)DIFFERENT_FREQIncompatibleFrequencyPeriodget_period_field_arrperiod_asfreq_arr)cache_readonlydoc)find_stack_level)ensure_objectpandas_dtype)DatetimeTZDtypePeriodDtype)ABCIndexABCPeriodIndex	ABCSeriesABCTimedeltaArray)isna)datetimelike)Sequence)AnyArrayLikeDtypeFillnaOptionsNpDtypeNumpySorterNumpyValueArrayLikeSelfnpt)DatetimeArrayTimedeltaArray)ExtensionArrayBaseOffsetT)boundklassPeriodArrayc                @   ^  U 4S jnT Ul         Xl        [        U5      $ )Nc                b   > U R                   R                  n[        TU R                  U5      nU$ N)dtype_dtype_coder$   asi8)selfbaseresultnames      K/var/www/html/env/lib/python3.13/site-packages/pandas/core/arrays/period.pyf_field_accessor.<locals>.fm   s)    zz%%%dDIIt<    )__name____doc__property)rL   	docstringrN   s   `  rM   _field_accessorrU   l   s     
 AJIA;rP   c                  b  ^  \ rS rSr% SrSrSr\R                  " \	5      r
\4rS rSr\STS j5       r/ rS\S	'   S
/rS\S'   / SQrS\S'   / SQrS\S'   \\-   \-   rS\S'   / SQrS\S'   S\S'    SU     SVS jjr\      SWS j5       r\SSS.     SXS jj5       r\SSS.     SXS jj5       r\SYSZS jj5       r\S 5       r\S[S j5       r    S\S jr S]S  jr!S^S! jr"\#S_S" j5       r$\S`S# j5       r%\SaS$ j5       r& Sb     ScS% jjr'SYS& jr(\)" S'S(5      r*\)" S)S*5      r+\)" S+S,5      r,\)" S-S.5      r-\)" S/S05      r.\)" S1S25      r/\)" S3S45      r0\0r1\)" S5S65      r2\2r3\3r4\)" S7S85      =r5r6\)" S9S:5      r7\)" S;5      r8\)" S<S=5      r9\9r:\SdS> j5       r;SeSfS? jjr<SgS@ jr=\>" SS0 \?DSASASB.D6ShSiSC jj5       r@SjSkSD jjrASESSF.   SlSG jjrBSmSnU 4SI jjjrC  So       SpSJ jjrDSSSHSK.         SqSL jjrE Sr     SsU 4SM jjjrF      StSN jrGSuSO jrHU 4SP jrI    SvSQ jrJSR rKSSrLU =rM$ )wrB   y   a  
Pandas ExtensionArray for storing Period data.

Users should use :func:`~pandas.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).
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`.

Examples
--------
>>> pd.arrays.PeriodArray(pd.PeriodIndex(['2023-01-01',
...                                       '2023-01-02'], freq='D'))
<PeriodArray>
['2023-01-01', '2023-01-02']
Length: 2, dtype: period[D]
i  periodarrayc                "    [        U [        5      $ rE   )
isinstancer,   )xs    rM   <lambda>PeriodArray.<lambda>   s    Z	;&rP   )r   c                    [         $ rE   )r#   rI   s    rM   _scalar_typePeriodArray._scalar_type   s    rP   z	list[str]
_other_opsis_leap_year	_bool_ops)
start_timeend_timefreq_object_ops)yearmonthdayhourminutesecond
weekofyearweekdayweek	dayofweekday_of_week	dayofyearday_of_yearquarterqyeardays_in_monthdaysinmonth
_field_ops_datetimelike_ops)strftimeto_timestampasfreq_datetimelike_methodsr,   _dtypeNFc                .   Ub8  [         R                  " S[        [        5       S9  [	        X#5      n[        U5      nUb/  [        U5      n[        U[
        5      (       d  [        SU S35      e[        U[        5      (       a2  UR                  n[        U[        U 5      5      (       d  [        S5      eO![        U[        5      (       a  UR                  n[        U[        U 5      5      (       a>  Ub$  X!R                  :w  a  [        XR                   5      eUR"                  UR                  p!U(       d  [$        R&                  " USS9nO[$        R(                  " USUS9nUc  [        S	5      e[+        [
        U5      n[,        R.                  " XU5        g )
Nz}The 'freq' keyword in the PeriodArray constructor is deprecated and will be removed in a future version. Pass 'dtype' instead)
stacklevelzInvalid dtype z for PeriodArrayzIncorrect dtypeint64rF   rF   copyz-dtype is not specified and cannot be inferred)warningswarnFutureWarningr(   validate_dtype_freqr,   r*   rZ   
ValueErrorr/   _valuestype	TypeErrorr.   rF   raise_on_incompatiblerg   _ndarraynpasarrayarrayr
   r   __init__)rI   valuesrF   rg   r   s        rM   r   PeriodArray.__init__   sM    MMP+-	 'u3D%E 'Ee[11 >%8H!IJJfi((^^Ffd4j11 122 2 //^^Ffd4j)) Ull%:+FJJ??"OOV\\EZZg6FXXfG$?F=LMM[%(tU3rP   c                ~    Sn[        U[        R                  5      (       a  UR                  S:X  d   U5       eU " XS9$ )Nz Should be numpy array of type i8i8r   )rZ   r   ndarrayrF   )clsr   rF   assertion_msgs       rM   _simple_newPeriodArray._simple_new  s;     ;&"**--&,,$2FUUF6''rP   r   c                  Ub  [        U5      nU(       a"  [        U[        5      (       a  UR                  nOS n[        X5      (       a/  [	        UR
                  U5        U(       a  UR                  5       nU$ [        R                  " U[        S9nU=(       d    [        R                  " U5      n[        R                  " XT5      n[        U5      nU " XbS9$ )Nr   )r*   rZ   r,   rg   r   rF   r   r   r   object	libperiodextract_freqextract_ordinals)r   scalarsrF   r   rg   periodsordinalss          rM   _from_sequencePeriodArray._from_sequence  s      'EZ{33::DDg##t4!,,.N**WF36y--g6--g<D!8))rP   c               "    U R                  XUS9$ )Nr   )r   )r   stringsrF   r   s       rM   _from_sequence_of_strings%PeriodArray._from_sequence_of_strings4  s     !!'T!BBrP   c                    [        U[        5      (       a   [        UR                  UR                  5      n[        XU5      u  p[        U5      nU " XS9$ )z
Construct a PeriodArray from a datetime64 array

Parameters
----------
data : ndarray[datetime64[ns], datetime64[ns, tz]]
freq : str or Tick
tz : tzinfo, optional

Returns
-------
PeriodArray[freq]
r   )rZ   r   r   nrL   r   r,   )r   datarg   tzrF   s        rM   _from_datetime64PeriodArray._from_datetime64:  sH     dJ'')$&&$))<D)$b9
D!4%%rP   c                    [         R                  " U5      nUb  [        R                  " U5      nUc  Ub  [	        XX45      u  pTXT4$ [        S5      e)Nz/Not enough parameters to construct Period range)dtlvalidate_periodsr#   _maybe_convert_freq_get_ordinal_ranger   )r   startendr   rg   subarrs         rM   _generate_rangePeriodArray._generate_rangeO  sX    &&w/--d3D-e'HLF | NOOrP   c               T    [        SSU0UD6u  p2[        U5      nU R                  X4S9$ )Nrg   r    )_range_from_fieldsr,   r   )r   fieldsrg   r   rF   s        rM   _from_fieldsPeriodArray._from_fields]  s1    )>t>v>D!v33rP   c                   U[         L a   [        R                  " UR                  5      $ [	        XR
                  5      (       a1  U R                  U5        [        R                  " UR                  5      $ [        SU S35      e)Nz!'value' should be a Period. Got 'z
' instead.)	r   r   r   _valuerZ   r`   _check_compatible_withordinalr   rI   values     rM   _unbox_scalarPeriodArray._unbox_scalari  se     C<88ELL))0011''.88EMM**@zRSSrP   c                (    [        XR                  S9$ )N)rg   )r#   rg   r   s     rM   _scalar_from_stringPeriodArray._scalar_from_stringv  s    e)),,rP   c                N    U[         L a  g U R                  UR                  5        g rE   )r   _require_matching_freqrg   rI   others     rM   r   "PeriodArray._check_compatible_with|  s     C< 	##EJJ/rP   c                    U R                   $ rE   )r   r_   s    rM   rF   PeriodArray.dtype  s    {{rP   c                .    U R                   R                  $ )z3
Return the frequency object for this PeriodArray.
rF   rg   r_   s    rM   rg   PeriodArray.freq  s    
 zzrP   c                j    [        U R                  R                  U R                  R                  5      $ rE   )r   rg   r   rL   r_   s    rM   freqstrPeriodArray.freqstr  s    %diikk499>>BBrP   c                    US:X  a  U R                   $ U[        :X  a  U R                  ) $ [        R                  " [        U 5      [        S9$ )Nr   r   )rH   bool_isnanr   r   listr   )rI   rF   r   s      rM   	__array__PeriodArray.__array__  s?     D=99d]KK< xxT
&11rP   c                   SSK nSSKJn  Ub  UR                  R	                  U5      (       a)  UR                  U R                  U R                  5       US9$ [        X5      (       aA  U R                  UR                  :w  a&  [        SU R                   SUR                   S35      eO[        SU S	35      eU" U R                  5      nUR                  U R                  U R                  5       S
S9nUR                  R                  XE5      $ )z&
Convert myself into a pyarrow Array.
r   N)ArrowPeriodType)maskr   zENot supported to convert PeriodArray to array with different 'freq' (z vs )z)Not supported to convert PeriodArray to 'z' typer   )pyarrow(pandas.core.arrays.arrow.extension_typesr   types
is_integerr   r   r1   rZ   r   rg   r   r>   from_storage)rI   r   r   r   period_typestorage_arrays         rM   __arrow_array__PeriodArray.__arrow_array__  s     	L}}''--}}T]]4}PPD22<<499,###'<<.TYYKqB  -  ?vVL  &dll3dmm$))+GT%%22;NNrP   ri   z
        The year of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
        >>> idx.year
        Index([2023, 2024, 2025], dtype='int64')
        rj   z
        The month as January=1, December=12.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.month
        Index([1, 2, 3], dtype='int64')
        rk   z
        The days of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(['2020-01-31', '2020-02-28'], freq='D')
        >>> idx.day
        Index([31, 28], dtype='int64')
        rl   z
        The hour of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01 10:00", "2023-01-01 11:00"], freq='h')
        >>> idx.hour
        Index([10, 11], dtype='int64')
        rm   a  
        The minute of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01 10:30:00",
        ...                       "2023-01-01 11:50:00"], freq='min')
        >>> idx.minute
        Index([30, 50], dtype='int64')
        rn   a	  
        The second of the period.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01 10:00:30",
        ...                       "2023-01-01 10:00:31"], freq='s')
        >>> idx.second
        Index([30, 31], dtype='int64')
        rq   a   
        The week ordinal of the year.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.week  # It can be written `weekofyear`
        Index([5, 9, 13], dtype='int64')
        rs   z
        The day of the week with Monday=0, Sunday=6.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-01", "2023-01-02", "2023-01-03"], freq="D")
        >>> idx.weekday
        Index([6, 0, 1], dtype='int64')
        ru   a  
        The ordinal day of the year.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01-10", "2023-02-01", "2023-03-01"], freq="D")
        >>> idx.dayofyear
        Index([10, 32, 60], dtype='int64')

        >>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
        >>> idx
        PeriodIndex(['2023', '2024', '2025'], dtype='period[Y-DEC]')
        >>> idx.dayofyear
        Index([365, 366, 365], dtype='int64')
        rv   z
        The quarter of the date.

        Examples
        --------
        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.quarter
        Index([1, 1, 1], dtype='int64')
        rw   rx   a  
        The number of days in the month.

        Examples
        --------
        For Series:

        >>> period = pd.period_range('2020-1-1 00:00', '2020-3-1 00:00', freq='M')
        >>> s = pd.Series(period)
        >>> s
        0   2020-01
        1   2020-02
        2   2020-03
        dtype: period[M]
        >>> s.dt.days_in_month
        0    31
        1    29
        2    31
        dtype: int64

        For PeriodIndex:

        >>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
        >>> idx.days_in_month   # It can be also entered as `daysinmonth`
        Index([31, 28, 31], dtype='int64')
        c                T    [        [        R                  " U R                  5      5      $ )z
Logical indicating if the date belongs to a leap year.

Examples
--------
>>> idx = pd.PeriodIndex(["2023", "2024", "2025"], freq="Y")
>>> idx.is_leap_year
array([False,  True, False])
)r   r   r   ri   r_   s    rM   rc   PeriodArray.is_leap_yearb  s     bjj344rP   c                   SSK Jn  [        R                  " U5      nUS:H  nU(       ak  US:X  d  U R                  S:X  a+  [        SS5      [        SS5      -
  nU R                  SS	9U-   $ [        SS5      nX R                  -   R                  SS	9U-
  $ Uc5  U R                  R                  5       n[        US5      nUR                  nUnO"[        R                  " U5      nUR                  nU R                  XS	9n	[        R                  " U	R                   U5      n
UR"                  " U
5      nU R                  R$                  S:X  a  [&        R(                  " U R                   5      n[+        U5      S:X  aR  US   nXR,                  R.                  :X  a  U R                  Ul        U$ US:X  a  U R                  R2                  Ul        U$ UR5                  S
5      $ )a  
Cast to DatetimeArray/Index.

Parameters
----------
freq : str or DateOffset, optional
    Target frequency. The default is 'D' for week or longer,
    's' otherwise.
how : {'s', 'e', 'start', 'end'}
    Whether to use the start or end of the time period being converted.

Returns
-------
DatetimeArray/Index

Examples
--------
>>> idx = pd.PeriodIndex(["2023-01", "2023-02", "2023-03"], freq="M")
>>> idx.to_timestamp()
DatetimeIndex(['2023-01-01', '2023-02-01', '2023-03-01'],
dtype='datetime64[ns]', freq='MS')
r   )r<   EB   Dnsr   )howinfer)pandas.core.arraysr<   r   validate_end_aliasrg   r   r}   r   _get_to_timestamp_baser   _freqstrr#   r   _period_dtype_coder~   periodarr_to_dt64arrrH   r   rL   libalgosunique_deltaslenrF   _n_freqrJ   
_with_freq)rI   rg   r   r<   r   adjust	freq_coderF   rJ   new_parrnew_datadtadiffsdiffs                 rM   r}   PeriodArray.to_timestampo  s   . 	5**3/Sjs{dii3."1c*Yq$-??((W(5>>"1d+yy(6676CfLL<::<I#Iq1E>>DD--d3D**D;;t;-11(--F**8499>>S  **4995E5zQQx::==( $		CI J QY $		CIJ>>'**rP   c                >    [         R                  " XR                  S9$ )N)r   rg   )r#   _from_ordinalrg   )rI   r[   s     rM   	_box_funcPeriodArray._box_func  s    ##AII>>rP   PeriodIndex)r   
other_namec                   [         R                  " U5      n[        U[        5      (       a&  [	        US5      (       a  [        U5      R                  n[        R                  " U5      nU R                  R                  nUR                  nU R                  nUS:H  nU(       a  XPR                  R                  -   S-
  nOUn[        XsXF5      nU R                   (       a  ["        XR$                  '   [        U5      n	['        U 5      " XS9$ )a  
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='Y')
>>> pidx
PeriodIndex(['2010', '2011', '2012', '2013', '2014', '2015'],
dtype='period[Y-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]')
r   r   r   r   )r   r   rZ   r   hasattrr,   r   r#   r   r   rG   r   rH   rF   r   r%   _hasnar   r   r   )
rI   rg   r   base1base2rH   r   r   r  rF   s
             rM   r~   PeriodArray.asfreq  s    \ **3/dJ''GD:N,O,Ot$--D))$/''''yySjZZ]]*Q.GG$WU@;;$(H[[!D!Dz(00rP   c                4    U(       a  [         $ SR                  $ )Nz'{}')strformat)rI   boxeds     rM   
_formatterPeriodArray._formatter  s    J}}rP   r   )na_repdate_formatc               n    [         R                  " U R                  U R                  R                  X5      $ )z#
actually format my specific types
)r   period_array_strftimerH   rF   rG   )rI   r  r  kwargss       rM   _format_native_types PeriodArray._format_native_types  s,     ..IItzz--v
 	
rP   Tc                  > [        U5      nXR                  :X  a  U(       d  U $ U R                  5       $ [        U[        5      (       a  U R                  UR                  5      $ [        R                  " US5      (       d  [        U[        5      (       aQ  [        USS 5      n[        R                  " U5      nU R                  5       R                  U5      R                  U5      $ [         TU ]E  XS9$ )NMr   r   )r*   r   r   rZ   r,   r~   rg   r   is_np_dtyper+   getattrr   dtype_to_unitr}   tz_localizeas_unitsuperastype)rI   rF   r   r   unit	__class__s        rM   r-  PeriodArray.astype  s     U#KKyy{"e[));;uzz**??5#&&*UO*L*Ld+B$$U+D$$&2226>>tDDw~e~//rP   c                    U R                  U5      R                  S5      nU R                  R                  S5      nUR                  XBUS9$ )NM8[ns])sidesorter)_validate_setitem_valueviewr   searchsorted)rI   r   r3  r4  npvaluem8arrs         rM   r7  PeriodArray.searchsorted$  sK     ..u5::8D ""8,!!'V!DDrP   )limit
limit_arear   c                   U R                  S5      nUR                  XX4S9nU(       a%  [        SUR                  U R                  5      5      $ U $ )Nr2  )methodr;  r<  r   r:   )r6  _pad_or_backfillr
   rF   )rI   r>  r;  r<  r   r  rK   s          rM   r?  PeriodArray._pad_or_backfill1  sP     ii!%%: & 
 DJJ 788KrP   c                   > Ub<  U R                  S5      nUR                  XX4S9nUR                  U R                  5      $ [        TU ]  XX4S9$ )Nr2  )r   r>  r;  r   )r6  fillnarF   r,  )rI   r   r>  r;  r   r  rK   r/  s          rM   rB  PeriodArray.fillnaD  sU      ))H%CZZe%ZSF ;;tzz**w~E~QQrP   c                    U[         R                  [         R                  4;   d   eU[         R                  L a  U* n[        U R                  [
        R                  " USS95      n[        U 5      " X0R                  S9$ )z
Add or subtract array of integers.

Parameters
----------
other : np.ndarray[int64] or int
op : {operator.add, operator.sub}

Returns
-------
result : PeriodArray
r   r   )	operatoraddsubr   rH   r   r   r   rF   )rI   r   op
res_valuess       rM   _addsub_int_array_or_scalar'PeriodArray._addsub_int_array_or_scalarT  s`     hllHLL1111FE%diiE1NO
Dz*JJ77rP   c                    [        U[        5      (       a   eU R                  USS9  U R                  UR                  [
        R                  5      $ )NT)rJ   )rZ   r   r   rJ  r   rE  rF  r   s     rM   _add_offsetPeriodArray._add_offseti  sC    eT****##E#5//FFrP   c                
  > [        U R                  [        5      (       d  [        X5      e[	        U5      (       a  [
        TU ]  U5      $ [        R                  " [        U5      R                  5      nU R                  U5      $ )z\
Parameters
----------
other : timedelta, Tick, np.timedelta64

Returns
-------
PeriodArray
)rZ   rg   r   r   r1   r,  _add_timedeltalike_scalarr   r   r   asm8_add_timedelta_arraylike)rI   r   tdr/  s      rM   rP  %PeriodArray._add_timedeltalike_scalarp  sd     $))T**'44;;74U;;ZZ	%(--.,,R00rP   c                   U R                   R                  5       (       d  [        SU R                    35      e[        R                   " SU R                   R                   S35      n [        [        R                  " U5      USSS9n[        U R                  [        R                  " UR                  S5      5      5      n[        U 5      " XPR                   S	9$ ! [         a  n[        S5      UeSnAff = f)
zc
Parameters
----------
other : TimedeltaArray or ndarray[timedelta64]

Returns
-------
PeriodArray
z2Cannot add or subtract timedelta64[ns] dtype from m8[]FrF   r   round_okznCannot add/subtract timedelta-like from PeriodArray that is not an integer multiple of the PeriodArray's freq.Nr   r   )rF   _is_tick_liker   r   
_td64_unitr   r   r   r"   r   rH   r6  r   )rI   r   rF   deltaerrrI  s         rM   rR  $PeriodArray._add_timedelta_arraylike  s     zz''))DTZZLQ  3tzz445Q78
	'

5!UUE &diiEJJt<L1MN
Dz*JJ77  	 (E 	s   ' C 
C4#C//C4c                   U R                   R                  5       (       d   e[        R                   " SU R                   R                   S35      n[	        U[
        [        R                  [        45      (       a*  [        R                  " [        U5      R                  5      nO[        R                  " U5      n [        X2SSS9nUR                  S5      n[        R                   " U5      $ ! [         a  n[        X5      UeSnAff = f)a  
Arithmetic operations with timedelta-like scalars or array `other`
are only valid if `other` is an integer multiple of `self.freq`.
If the operation is valid, find that integer multiple.  Otherwise,
raise because the operation is invalid.

Parameters
----------
other : timedelta, np.timedelta64, Tick,
        ndarray[timedelta64], TimedeltaArray, TimedeltaIndex

Returns
-------
multiple : int or ndarray[int64]

Raises
------
IncompatibleFrequency
rV  rW  FrX  Nr   )rF   rZ  r   r[  rZ   r   timedelta64r   r   r   rQ  r   r   r   r6  r   item_from_zerodim)rI   r   rF   rS  r\  r]  s         rM    _check_timedeltalike_freq_compat,PeriodArray._check_timedeltalike_freq_compat  s    ( zz''))))3tzz445Q78ei>??Ie,112BE"B	>'eeTE 

4 $$U++	  	>'4#=	>s   ;C- -
D7DDr   )returnztype[Period])NNF)rF   Dtype | Noner   r   rd  None)r   znpt.NDArray[np.int64]rF   r,   rd  r:   )rF   re  r   r   rd  r:   rE   )rd  r:   )r   dictrd  r:   )r   Period | NaTTyperd  znp.int64)r   r  rd  r#   )r   zPeriod | NaTType | PeriodArrayrd  rf  )rd  r,   )rd  r   )rd  r  )NN)rF   zNpDtype | Noner   zbool | Nonerd  z
np.ndarray)rd  znpt.NDArray[np.bool_])Nr   )r   r  rd  r<   )rd  rh  )Nr   )r   r  rd  r:   )F)r  r   )r  zstr | floatrd  znpt.NDArray[np.object_])T)r   r   )leftN)r   z$NumpyValueArrayLike | ExtensionArrayr3  zLiteral['left', 'right']r4  zNumpySorter | Nonerd  znpt.NDArray[np.intp] | np.intp)
r>  r6   r;  
int | Noner<  z#Literal['inside', 'outside'] | Noner   r   rd  r:   )NNNT)r;  rj  r   r   rd  r:   )r   znp.ndarray | intrH  zCallable[[Any, Any], Any]rd  r:   )r   r   )r   z,TimedeltaArray | npt.NDArray[np.timedelta64]rd  r:   )NrQ   
__module____qualname____firstlineno__rR   __array_priority___typr   r   r   _internal_fill_valuer#   _recognized_scalars_is_recognized_dtype_infer_matchesrS   r`   rb   __annotations__rd   rh   rz   r{   r   r   classmethodr   r   r   r   r   r   r   r   r   r&   rF   rg   r   r   r   rU   ri   rj   rk   rl   rm   rn   ro   rq   rs   rr   rp   rt   ru   rv   rw   rx   ry   rc   r}   r  r'   _shared_doc_kwargsr~   r  r"  r-  r7  r?  rB  rJ  rM  rP  rR  rb  __static_attributes____classcell__)r/  s   @rM   rB   rB   y   s   :z D88D>!) !N  J	*+Iy+?K?J	 & $.#;i#GyG'M9M KP'4)'4CG'4	'4T (%( ( 
	( ( 
 #* 	*
 * 
* *6 /3%C ,C;?C	C C
 & &(   4 4TT 
T-0     C C AE	2#	22=	2		2O< 	D 	E 	C 	D 		F 		F !	J D!	K IG-	 I$ 	G G$E#	M:  K
5 
5@+H? 	MM]}MC1 NC1P (-$
$
	 
0 0. *0%)	E3E 'E #	E
 
(E" !:>  	
 8  
( OSR.8RGKR	R R 8%8+D8	8*G1*#8A#8	#8J#, #,rP   c                (   [        U[        R                  [        45      (       d  Uc  SnO[        U[        5      (       a!  [        UR                  UR                  5      nOK[        U[        [        [        45      (       a  UR                  nO[        [        U5      5      R                  n[        U R                  R                  U R                  R                  5      n[        R                   " [#        U 5      R$                  X2S9n['        U5      $ )a  
Helper function to render a consistent error message when raising
IncompatibleFrequency.

Parameters
----------
left : PeriodArray
right : None, DateOffset, Period, ndarray, or timedelta-like

Returns
-------
IncompatibleFrequency
    Exception to be raised by the caller.
N)r   own_freq
other_freq)rZ   r   r   r0   r   r   r   rL   r.   rB   r#   r   r    r   rg   r!   r  r   rQ   r"   )ri  rightr{  rz  msgs        rM   r   r     s      %"**&7899U]
	E:	&	&+EGGUZZ@
	ENK@	A	A]]
"9U#34<<
%diikk499>>BH


J(C !%%rP   c                p   [        U SS5      n[        R                  " US5      (       a  [        R	                  X5      $ [        U[        5      (       a2  [        U 5      nUb"  XR                  :X  a  U$ UR                  U5      $ U$ [        U [        R                  [        [        [        45      (       d  [        U 5      n [        R                  " U 5      nU(       a  [        U5      nOSnUR                  R                   S:X  a  [#        U5      S:  a  [%        S5      eUR                  R                   S;   a=  UR'                  [        R(                  SS	9n[*        R,                  " Xq5      n[        XS
9$ [/        U5      n Uc  [*        R0                  " U 5      n[        U5      n[        R3                  XS
9$ )a.  
Construct a new PeriodArray from a sequence of Period scalars.

Parameters
----------
data : Sequence of Period objects
    A sequence of Period objects. These are required to all have
    the same ``freq.`` Missing values can be indicated by ``None``
    or ``pandas.NaT``.
freq : str, Tick, or Offset
    The frequency of every element of the array. This can be specified
    to avoid inferring the `freq` from `data`.
copy : bool, default False
    Whether to ensure a copy of the data is made.

Returns
-------
PeriodArray

See Also
--------
PeriodArray
pandas.PeriodIndex

Examples
--------
>>> period_array([pd.Period('2017', freq='Y'),
...               pd.Period('2018', freq='Y')])
<PeriodArray>
['2017', '2018']
Length: 2, dtype: period[Y-DEC]

>>> period_array([pd.Period('2017', freq='Y'),
...               pd.Period('2018', freq='Y'),
...               pd.NaT])
<PeriodArray>
['2017', '2018', 'NaT']
Length: 3, dtype: period[Y-DEC]

Integers that look like years are handled

>>> period_array([2000, 2001, 2002], freq='D')
<PeriodArray>
['2000-01-01', '2001-01-01', '2002-01-01']
Length: 3, dtype: period[D]

Datetime-like strings may also be passed

>>> period_array(['2000-Q1', '2000-Q2', '2000-Q3', '2000-Q4'], freq='Q')
<PeriodArray>
['2000Q1', '2000Q2', '2000Q3', '2000Q4']
Length: 4, dtype: period[Q-DEC]
rF   Nr%  rN   r   z9PeriodIndex does not allow floating point in constructioniuFr&  r   )r(  r   r'  rB   r   rZ   r,   rg   r~   r   r   r   tupler/   r   rF   kindr   r   r-  r   r   from_ordinalsr)   r   r   )	r   rg   r   
data_dtypeoutarrdatarF   arrr   s	            rM   period_arrayr    sg   t w-J
z3''++D77*k**$&
::d##
 dRZZui@AADzjjG D!}}S S\A%5STT}}T!nnRXXEn2 **35811!D|%%d+E%%d%88rP   c                    g rE   r   r   s     rM   r   r   W      rP   c                    g rE   r   r   s     rM   r   r   \  r  rP   c                    Ub
  [        USS9nU bV  [        U 5      n [        U [        5      (       d  [	        S5      eUc  U R
                  nU$ XR
                  :w  a  [        S5      eU$ )a<  
If both a dtype and a freq are available, ensure they match.  If only
dtype is available, extract the implied freq.

Parameters
----------
dtype : dtype
freq : DateOffset or None

Returns
-------
freq : DateOffset

Raises
------
ValueError : non-period dtype
IncompatibleFrequency : mismatch between dtype and freq
T	is_periodzdtype must be PeriodDtypez&specified freq and dtype are different)r   r*   rZ   r,   r   rg   r"   r   s     rM   r   r   a  ss    * .U#%--899<::D
 K	 ZZ'(PQQ KrP   c                z   [        U R                  [        R                  5      (       a  U R                  R                  S:w  a  [	        SU R                   35      eUcd  [        U [
        5      (       a  U R                  U R                  pO^[        U [        5      (       a!  U R                  U R                  R                  pO'[        U [
        [        45      (       a  U R                  n [        U R                  5      n[        R                  " U5      nUR                  n[        U R                  S5      XBUS9U4$ )a  
Convert an datetime-like array to values Period ordinals.

Parameters
----------
data : Union[Series[datetime64[ns]], DatetimeIndex, ndarray[datetime64ns]]
freq : Optional[Union[str, Tick]]
    Must match the `freq` on the `data` if `data` is a DatetimeIndex
    or Series.
tz : Optional[tzinfo]

Returns
-------
ordinals : ndarray[int64]
freq : Tick
    The frequency extracted from the Series or DatetimeIndex if that's
    used.

r%  zWrong dtype: r   )reso)rZ   rF   r   r  r   r-   r   rg   r/   dtr   r#   r   r   c_dt64arr_to_periodarrr6  )r   rg   r   r  rJ   s        rM   r   r     s    , djj"((++tzz#/E=566|dH%%tyy$i((tww||$	D8Y/	0	0||tzz*D%%d+D""D!$))D/4$GMMrP   c                   [         R                  " XU5      S:w  a  [        S5      eUb  [        USS9nUR                  nU b  [        X5      n Ub  [        X5      n[        U [
        5      n[        U[
        5      nU(       a,  U(       a%  U R                  UR                  :w  a  [        S5      eU [        L d	  U[        L a  [        S5      eUc?  U(       a  U R                  nOU(       a  UR                  nO[        S5      eUR                  nUb  X$-  nU cE  [        R                  " UR                  U-
  U-   UR                  S-   U[        R                  S	9nXs4$ [        R                  " U R                  U R                  U-   U[        R                  S	9n Xs4$ [        R                  " U R                  UR                  S-   U[        R                  S	9nXs4$ )
N   zOOf the three parameters: start, end, and periods, exactly two must be specifiedTr  z!start and end must have same freqzstart and end must not be NaTz#Could not infer freq from start/endr   r   )comcount_not_noner   r   r   r#   rZ   rg   r   r   aranger   r   )r   r   r   rg   multis_start_per
is_end_perr   s           rM   r   r     s   
%g.!3,
 	

 .vvu#
SeV,LC(J
uzzSXX'=<==|scz899|::D88DBCCvv.=99g%,ckkAot288D : 99u}}w6BHHD : yyaRXXN:rP   c                *   Uc  SnUc  SnUc  SnUc  Sn/ nUb  Uc%  [        SSS9n[        R                  R                  n	OI[        USS9n[        R
                  " U5      n	U	[        R                  R                  :w  a  [        S5      eUR                  n
[        X5      u  p[        X5       HL  u  p[        R                  " XU
5      u  p[        R                  " XSSSSSSU	5	      nUR                  U5        MN     Op[        USS9n[        R
                  " U5      n	[        XX4XV5      n[        U6  H7  u  nnnnnnUR                  [        R                  " UUUUUUSSU	5	      5        M9     [        R                  " U[        R                   S9U4$ )Nr   r   QTr  zbase must equal FR_QTRr   )r   r   FR_QTRr   r   freq_to_dtype_codeAssertionErrorr   _make_field_arrayszipr   quarter_to_myearperiod_ordinalappendr   r   r   )ri   rj   rv   rk   rl   rm   rn   rg   r   rJ   r   yqcalendar_yearcalendar_monthvalarraysmthdhmnss                         rM   r   r     s    |~~
{H<SD1D##))DTT2D//5Dy''---$%=>>,,*49&DA,3,D,DQ7,S)M**q!Q1aC OOC  ' .++D1#DFK#&<AsAq"aOOI44QQ2q!QPTUV $0 88HBHH-t33rP   c            	        S nU  H\  n[        U[        [        R                  [        45      (       d  M/  Ub  [        U5      U:w  a  [        S5      eUb  MQ  [        U5      nM^     U  Vs/ s HY  n[        U[        R                  [        [        45      (       a  [        R                  " U5      O[        R                  " X!5      PM[     sn$ s  snf )NzMismatched Period array lengths)	rZ   r   r   r   r/   r   r   r   repeat)r   lengthr[   s      rM   r  r    s    Fa$

I677!c!f&6 !BCC~Q  	 A a"**dI677 	

1YYq!	" 	  s   )A CrE   )rL   r  rT   z
str | None)rd  r"   )NF)r   z,Sequence[Period | str | None] | AnyArrayLikerg   zstr | Tick | BaseOffset | Noner   r   rd  rB   )rg   r?   rd  r?   )rg   ztimedelta | str | Nonerd  r   )rg   z1BaseOffsetT | BaseOffset | timedelta | str | Nonerd  r?   )rd  z(tuple[npt.NDArray[np.int64], BaseOffset])r   )r  int)NNNNNNNN)rd  ztuple[np.ndarray, BaseOffset])rd  zlist[np.ndarray])h
__future__r   datetimer   rE  typingr   r   r   r   r	   r
   r   r   numpyr   pandas._libsr   r   r   pandas._libs.arraysr   pandas._libs.tslibsr   r   r   r   r   r   r   r  r   r   r   r   r   r   pandas._libs.tslibs.dtypesr   r   r   pandas._libs.tslibs.fieldsr   pandas._libs.tslibs.offsetsr   r    pandas._libs.tslibs.periodr!   r"   r#   r$   r%   pandas.util._decoratorsr&   r'   pandas.util._exceptionsr(   pandas.core.dtypes.commonr)   r*   pandas.core.dtypes.dtypesr+   r,   pandas.core.dtypes.genericr-   r.   r/   r0   pandas.core.dtypes.missingr1   r   r2   r   pandas.core.commoncorecommonr  collections.abcr3   pandas._typingr4   r5   r6   r7   r8   r9   r:   r;   r<   r=   pandas.core.arrays.baser>   r?   rv  rU   DatelikeOpsPeriodMixinrB   r   r  r   r   r   r  r   rP   rM   <module>r     s   "       .    
 6  5  , 2    (	 	 	 7 m:6 ] 
T,#//9#8#8 T,n&L ,0`9
6`9
(`9 `9 	`9F 
 
 
 
"B""L %N-%NP.d 

		.4 #.4brP   