
    I jK                    b   S SK Jr  S SKJrJr  S SKJrJr  S SKrS SK	J
r  S SKJrJrJrJrJrJr  S SKJr  S SKJrJrJr  S S	KJr  S S
KJr  S SKJr  S SKJ r   S SK!J"r"J#r#J$r$J%r%  S SK&J's  J(r)  S SK*J's  J+s  J,r-  S SK*J.r.  S SK/J0r0  S SK1J2r2J3r3  S SK4J5r5  \(       a  S SK6J7r7  S SK8J9r9J:r:J;r;  \<" \-Rz                  5      r=\=R}                  SS05        SS0r?S r@\5" SSS/\"R                  Q\"SS9\5" S/\"5      \" S5       " S  S!\05      5       5       5       rB\" S5           S#     S$S" jj5       rCg)%    )annotations)datetime	timedelta)TYPE_CHECKINGSelfN)index)
BaseOffsetDayNaTPeriod
ResolutionTick)OFFSET_TO_PERIOD_FREQSTR)cache_readonlydoc
set_module)
is_integer)PeriodDtype)	ABCSeries)is_valid_na_for_dtype)PeriodArrayperiod_arrayraise_on_incompatiblevalidate_dtype_freq)maybe_extract_name)DatetimeIndexOpsMixin)DatetimeIndexIndex)inherit_names)Hashable)DtypeDtypeObjnpttarget_klasszPeriodIndex or list of Periodsklassr   c                    UR                  S5      nUR                  S:X  a9  UR                  SS 5      n[        U5      n[        X$S9nU R                  " U40 UD6$ U " U40 UD6$ )Ndataint64freqdtype)popr+   r   r   _simple_new)clsdvaluesr)   r+   s        k/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/pandas/core/indexes/period.py_new_PeriodIndexr2   F   sc    UU6]F||wuuVT"D!V1v+++6Q    strftime
start_timeend_timeT)wrapis_leap_yearpandasc            
      R  ^  \ rS rSr% SrSrS\S'   S\S'   S\S	'   \rS
r	\
S(S j5       r\S)S j5       r\" \R                  4SSS.\D6S*S+S jj5       r\" \R"                  5      S,S-S jj5       r\
\" \R$                  R&                  5      S.S j5       5       r\
\" \R(                  R&                  5      S.S j5       5       r\
\" \R*                  R&                  5      S.S j5       5       r     S/       S0S jjr\SSSSSSSSS. S1S jj5       r\SS.S1S jj5       r\
S2S j5       rS3S jrS4S jrS5U 4S jjr\
S6S j5       r\
S7S j5       rU 4S  jr S! r!S8S" jr"S9S# jr#\" \$RJ                  5      S:U 4S$ jj5       r%S;S% jr&\" \$RN                  5      S<S=S& jj5       r'S'r(U =r)$ )>PeriodIndexR   a%  
Immutable ndarray holding ordinal values indicating regular periods in time.

Index keys are boxed to Period objects which carries the metadata (eg,
frequency information).

Parameters
----------
data : array-like (1d int np.ndarray or PeriodArray), optional
    Optional period-like data to construct index with.
freq : str or period object, optional
    One of pandas period strings or corresponding objects.
dtype : str or PeriodDtype, default None
    A dtype from which to extract a freq.
copy : bool, default None
    Whether to copy input data, only relevant for array, Series, and Index
    inputs (for other input, e.g. a list, a new array is created anyway).
    Defaults to True for array input and False for Index/Series.
    Set to False to avoid copying array input at your own risk (if you
    know the input data won't be modified elsewhere).
    Set to True to force copying Series/Index input up front.
name : str, default None
    Name of the resulting PeriodIndex.

Attributes
----------
day
dayofweek
day_of_week
dayofyear
day_of_year
days_in_month
daysinmonth
end_time
freq
freqstr
hour
is_leap_year
minute
month
quarter
qyear
second
start_time
week
weekday
weekofyear
year

Methods
-------
asfreq
strftime
to_timestamp
from_fields
from_ordinals

Raises
------
ValueError
    Passing the parameter data as a list without specifying either freq or
    dtype will raise a ValueError: "freq not specified and cannot be inferred"

See Also
--------
Index : The base pandas Index type.
Period : Represents a period of time.
DatetimeIndex : Index with datetime64 data.
TimedeltaIndex : Index of timedelta64 data.
period_range : Create a fixed-frequency PeriodIndex.

Examples
--------
>>> idx = pd.PeriodIndex(data=["2000Q1", "2002Q3"], freq="Q")
>>> idx
PeriodIndex(['2000Q1', '2002Q3'], dtype='period[Q-DEC]')
periodindexr   _datar	   r)   r   r+   Tc                "    [         R                  $ N)libindexPeriodEngineselfs    r1   _engine_typePeriodIndex._engine_type   s    $$$r3   c                .    U R                   R                  $ r@   )r+   _resolution_objrC   s    r1   rH   PeriodIndex._resolution_obj   s     zz)))r3   zarrays.PeriodArray)other
other_nameNc                |    U R                   R                  X5      n[        U 5      R                  X0R                  S9$ Nname)r>   asfreqtyper-   rO   rD   r)   howarrs       r1   rP   PeriodIndex.asfreq   s4     jj*Dz%%c		%::r3   c                t    U R                   R                  X5      n[        R                  " X0R                  S9$ rM   )r>   to_timestampr   r-   rO   rR   s       r1   rW   PeriodIndex.to_timestamp   s+    jj%%d0((99==r3   c                T    [        U R                  R                  U R                  SS9$ NFrO   copy)r   r>   hourrO   rC   s    r1   r]   PeriodIndex.hour   s     TZZ__4995AAr3   c                T    [        U R                  R                  U R                  SS9$ rZ   )r   r>   minuterO   rC   s    r1   r`   PeriodIndex.minute   !     TZZ&&TYYUCCr3   c                T    [        U R                  R                  U R                  SS9$ rZ   )r   r>   secondrO   rC   s    r1   rd   PeriodIndex.second   rb   r3   c                   S nU(       d'  [        U[        [        45      (       a  UR                  n[	        XQU 5      n[        X25      nU R                  XU5      u  pU(       a1  [        X5      (       a!  UR                  U:w  a  UR                  U5      n[        XS9nU(       a  UR                  5       nU R                  XUS9$ )N)r'   r)   )rO   refs)
isinstancer   r   _referencesr   r   _maybe_copy_array_inputr)   rP   r   r\   r-   )r.   r'   r)   r+   r\   rO   rg   s          r1   __new__PeriodIndex.__new__   s     
4%);<<##D!$c2"5/ 00UC

 Jt))dii4.? ;;t$D 199;DtT::r3   )yearquartermonthdayr]   r`   rd   r)   c                   UUUUUUUS.n	U	R                  5        V
Vs0 s H  u  pUc  M
  X_M     n	n
n[        R                  " XS9nU R                  U5      $ s  snn
f )a  
Construct a PeriodIndex from fields (year, month, day, etc.).

Parameters
----------
year : int, array, or Series, default None
    Year for the PeriodIndex.
quarter : int, array, or Series, default None
    Quarter for the PeriodIndex.
month : int, array, or Series, default None
    Month for the PeriodIndex.
day : int, array, or Series, default None
    Day for the PeriodIndex.
hour : int, array, or Series, default None
    Hour for the PeriodIndex.
minute : int, array, or Series, default None
    Minute for the PeriodIndex.
second : int, array, or Series, default None
    Second for the PeriodIndex.
freq : str or period object, optional
    One of pandas period strings or corresponding objects.

Returns
-------
PeriodIndex

See Also
--------
PeriodIndex.from_ordinals : Construct a PeriodIndex from ordinals.
PeriodIndex.to_timestamp : Cast to DatetimeArray/Index.

Examples
--------
>>> idx = pd.PeriodIndex.from_fields(year=[2000, 2002], quarter=[1, 3])
>>> idx
PeriodIndex(['2000Q1', '2002Q3'], dtype='period[Q-DEC]')
)rm   rn   ro   rp   r]   r`   rd   )fieldsr)   )itemsr   _from_fieldsr-   )r.   rm   rn   ro   rp   r]   r`   rd   r)   rr   keyvaluerT   s                r1   from_fieldsPeriodIndex.from_fields  sj    f 
 06||~S~*#*~S&&f@s## Ts
   	AArN   c                   [         R                  " U[         R                  S9n[        U5      n[        R
                  " XS9nU R                  XSS9$ )a  
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]')
r*   rN   )npasarrayr(   r   r   r-   )r.   ordinalsr)   rO   r+   r'   s         r1   from_ordinalsPeriodIndex.from_ordinalsA  sC    < ::hbhh7D!&&x=t//r3   c                4    [         R                  " U [        S9$ )Nr*   )rz   r{   objectrC   s    r1   r0   PeriodIndex.valuesg  s    zz$f--r3   c                   [        U[        [        R                  [        [        R
                  45      (       aC  [        U R                  [        [        45      (       a  U R                  R                  U5      nU$ Oy[        U[        5      (       a;  UR                  U R                  R                  :X  a  UR                  $ [        X5      e[        U5      (       a  [        U[        5      (       d   eU$ [        U S5      e)ae  
Convert timedelta-like input to an integer multiple of self.freq

Parameters
----------
other : timedelta, np.timedelta64, DateOffset, int, np.ndarray

Returns
-------
converted : int, np.ndarray[int64]

Raises
------
IncompatibleFrequency : if the input cannot be written as a multiple
    of self.freq.  Note IncompatibleFrequency subclasses ValueError.
N)rh   r   rz   timedelta64r   ndarrayr)   r
   r>    _check_timedeltalike_freq_compatr	   basenr   r   int)rD   rJ   deltas      r1   _maybe_convert_timedelta$PeriodIndex._maybe_convert_timedeltak  s    " eirzzJKK$))dC[11

CCEJ 2 z**zzTYY^^+ww'44eS))))L $D$//r3   c                     U R                   U:H  $ )z6
Can we compare values of the given dtype to our own?
r*   )rD   r+   s     r1   _is_comparable_dtype PeriodIndex._is_comparable_dtype  s     zzU""r3   c                   > [        U[        5      (       a   [        UR                  U R                  SS9nO [        U[        5      (       d  [        S5      e[        TU ]  X5      $ )za
where : array of timestamps
mask : np.ndarray[bool]
    Array of booleans where data is not NA.
F)r)   r\   z6asof_locs `where` must be DatetimeIndex or PeriodIndex)rh   r   r;   _valuesr)   	TypeErrorsuper	asof_locs)rD   wheremask	__class__s      r1   r   PeriodIndex.asof_locs  sQ     e]++DIIEJEE;//TUUw --r3   c                    [        U 5      S:X  a  gU R                  (       d  [        S5      eU R                  n[	        USS USS -
  S:  R                  5       5      $ )zq
Returns True if this PeriodIndex is range-like in that all Periods
between start and end are present, in order.
r   TzIndex is not monotonic   N   )lenis_monotonic_increasing
ValueErrorasi8boolall)rD   r0   s     r1   is_fullPeriodIndex.is_full  sZ     t9>++566fQRj6#2;.!388:;;r3   c                    g)Nperiod rC   s    r1   inferred_typePeriodIndex.inferred_type  s     r3   c                |   > [         TU ]  X5      nU R                  UR                  :X  a  U R                  U5      nU$ r@   )r   _convert_tolerancer+   r   )rD   	tolerancetargetr   s      r1   r   PeriodIndex._convert_tolerance  s:    
 G.yA	::%55i@Ir3   c                    UnU R                  U5        [        XR                  5      (       a  [        nO[	        U[
        5      (       ah   U R                  U5      u  p4U R                  U5      (       a   U R                  XC5      $ X@R                  :X  a  U R                  U5      nOd[        U5      e[	        U[        5      (       a  U R                  U5        O2[	        U[        5      (       a  U R                  U5      nO[        U5      e [         R"                  " X5      $ ! [         a  n[        SU S35      UeSnAff = f! [         a  n[        U5      UeSnAff = f! [         a  n[        U5      UeSnAff = f)aC  
Get integer location for requested label.

Parameters
----------
key : Period, NaT, str, or datetime
    String or datetime key must be parsable as Period.

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

Raises
------
KeyError
    Key is not present in the index.
TypeError
    If key is listlike or otherwise not hashable.
zCannot interpret 'z' as periodN)_check_indexing_errorr   r+   r   rh   str_parse_with_resor   KeyError_can_partial_date_slice_partial_date_slicerH   _cast_partial_indexing_scalarr   _disallow_mismatched_indexingr   r   get_loc)rD   ru   orig_keyparsedresoerrs         r1   r   PeriodIndex.get_loc  sa   ( ""3' jj11CS!!O#44S9
 ++D11133DAA +++ 88@sm#V$$..s3X&&44S9C 3-	.==++9  O!3C5DE3NO   1"3-S01,  	.8$#-	.sH   D" 5E E" "
E,D<<E
EEE"
E=,E88E=c                N    UR                   U R                  :w  a  [        U5      eg r@   )_dtyper+   r   )rD   ru   s     r1   r   )PeriodIndex._disallow_mismatched_indexing  s!    ::#3- $r3   c                j     [        XR                  S9nU$ ! [         a  n[        U5      UeS nAff = f)Nr)   )r   r)   r   r   )rD   labelr   r   s       r1   r   )PeriodIndex._cast_partial_indexing_scalar  s:    	+E		2F   	+5/s*	+s    
2-2c                n   > [        U[        5      (       a  U R                  U5      n[        TU ]  X5      $ r@   )rh   r   r   r   _maybe_cast_slice_bound)rD   r   sider   s      r1   r   #PeriodIndex._maybe_cast_slice_bound  s0    eX&&66u=Ew.u;;r3   c                    [         R                  " UR                  UR                  5      n[        X#S9nUR	                  U R
                  SS9UR	                  U R
                  SS94$ )Nr   start)rS   end)r   getattr_abbrevr   rP   r)   )rD   r   r   r)   ivs        r1   _parsed_string_to_bounds$PeriodIndex._parsed_string_to_bounds  sW    '++D,<,<d>N>NOF&		$))	1299TYYE93RSSr3   c                T    Ub"  [        S[        U 5      R                   S35      eX-   $ )Nz%`freq` argument is not supported for z.shift)r   rQ   __name__)rD   periodsr)   s      r1   shiftPeriodIndex.shift  s6    7T
8K8K7LFS  ~r3   r   )returnztype[libindex.PeriodEngine])r   r   )NE)rS   r   r   r   )Nr   )rS   r   r   r   )r   r   NNNNN)r+   zDtype | Noner\   zbool | NonerO   Hashable | Noner   r   )r   r   )r   znpt.NDArray[np.object_])r   zint | npt.NDArray[np.int64])r+   r"   r   r   )r   r   r   znpt.NDArray[np.bool_]r   z
np.ndarray)r   r   )r   r   )ru   r   r   None)r   r   r   r   )r   r   )r   r   r   r   )r   N)r   r   r   r   )*r   
__module____qualname____firstlineno____doc___typ__annotations__r   	_data_cls!_supports_partial_string_indexingpropertyrE   r   rH   r   rP   _shared_doc_kwargsrW   r]   fgetr`   rd   rk   classmethodrw   r}   r0   r   r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes____classcell__)r   s   @r1   r;   r;   R   sn   L\ D
I(,%% % * * 	"  	;; 		!	!"> #> 				B   B 			 	 !D " D 			 	 !D " D "  $!; 	!;
 !; !; 
!;F  <$ 
<$ <$| 37  0  0J . . 0D#. 
< 
<  <.|  			6	67< 8<T
 			$	$% &r3   r;   c                   [         R                  " XU5      S:w  a  [        S5      eUc,  [        U [        5      (       d  [        U[        5      (       d  Sn[
        R                  " XX#5      u  pS[        U5      n[        XVS9n[        XTSS9$ )a-  
Return a fixed frequency PeriodIndex.

The day (calendar) is the default frequency.

Parameters
----------
start : str, datetime, date, pandas.Timestamp, or period-like, default None
    Left bound for generating periods.
end : str, datetime, date, pandas.Timestamp, or period-like, default None
    Right bound for generating periods.
periods : int, default None
    Number of periods to generate.
freq : str or DateOffset, optional
    Frequency alias. By default the freq is taken from `start` or `end`
    if those are Period objects. Otherwise, the default is ``"D"`` for
    daily frequency.
name : str, default None
    Name of the resulting PeriodIndex.

Returns
-------
PeriodIndex
    A PeriodIndex of fixed frequency periods.

See Also
--------
date_range : Returns a fixed frequency DatetimeIndex.
Period : Represents a period of time.
PeriodIndex : Immutable ndarray holding ordinal values indicating regular periods
    in time.

Notes
-----
Of the three parameters: ``start``, ``end``, and ``periods``, exactly two
must be specified.

To learn more about the frequency strings, please see
:ref:`this link<timeseries.offset_aliases>`.

Examples
--------
>>> pd.period_range(start="2017-01-01", end="2018-01-01", freq="M")
PeriodIndex(['2017-01', '2017-02', '2017-03', '2017-04', '2017-05', '2017-06',
         '2017-07', '2017-08', '2017-09', '2017-10', '2017-11', '2017-12',
         '2018-01'],
        dtype='period[M]')

If ``start`` or ``end`` are ``Period`` objects, they will be used as anchor
endpoints for a ``PeriodIndex`` with frequency matching that of the
``period_range`` constructor.

>>> pd.period_range(
...     start=pd.Period("2017Q1", freq="Q"),
...     end=pd.Period("2017Q2", freq="Q"),
...     freq="M",
... )
PeriodIndex(['2017-03', '2017-04', '2017-05', '2017-06'],
            dtype='period[M]')
r   zOOf the three parameters: start, end, and periods, exactly two must be specifiedDr*   Fr[   )	comcount_not_noner   rh   r   r   _generate_ranger   r;   )r   r   r   r)   rO   r'   r+   s          r1   period_ranger   %  s    H %g.!3,
 	
 |Zv66z#v?V?V,,UGJDEt)DtU33r3   r   )r   z
int | NonerO   r   r   r;   )D
__future__r   r   r   typingr   r   numpyrz   pandas._libsr   rA   pandas._libs.tslibsr	   r
   r   r   r   r   pandas._libs.tslibs.dtypesr   pandas.util._decoratorsr   r   r   pandas.core.dtypes.commonr   pandas.core.dtypes.dtypesr   pandas.core.dtypes.genericr   pandas.core.dtypes.missingr   pandas.core.arrays.periodr   r   r   r   pandas.core.commoncorecommonr   pandas.core.indexes.baseindexesr   ibaser    pandas.core.indexes.datetimeliker   pandas.core.indexes.datetimesr   r   pandas.core.indexes.extensionr   collections.abcr    pandas._typingr!   r"   r#   dict_index_doc_kwargsupdater   r2   
_field_opsr;   r   r   r3   r1   <module>r	     s_   "
  *  @  1 1 0 <  !   ( ( 7 B 8(  001    .*JK L] 	  zCK,B,BC	
 -HI' I  .IX H
	 N4 N4
 N4 N4 N4r3   