
    Mh\                      S SK Jr  S SKJr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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$J%r%J&r&J'r'J(r(J)r)  S S	K*J+r+J,r,  S S
K-J.r.  S SK/J0r0  S SK1J2r2  S SK3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>J?r?J@r@JArAJBrBJCrC  S SKDJErF  S SKGJHrHJIrIJJrJ  S SKKJLrLJMrMJNrN  S SKOJPrP  S SKQJRrR  S SKSJTrTJUrUJVrVJWrWJXrXJYrY  S SKZJ[r[J\r\J]r]J^r^J_r_  S SK`JaraJbrb  S SKcJdrdJere  S SKfJgrgJhrhJiriJjrj  S SKkJlrlJmrmJnrn  S SKoJprp  S SKqJrrr  S SKsJtrtJuru  S SKvJwrw  S SKxJyry  S SKzJ{r{  S SK|J}s  J~r  S SKJrJrJr  S S KJrJr  S S!KJr  S S"KJrJr  S S#KJr  \(       a  S S$KJrJr  S S%KJr  S S&KJrJrJr  \\6\4   rS9S' jrS:S( jr " S) S*\r\t5      r " S+ S,\5      rS-rS.rS/rS0r " S1 S2\5      r      S;S3 jr\S<S4 j5       r\S=S5 j5       rS>S6 jr      S?S7 jrS@S8 jrg)A    )annotations)datetime	timedelta)wrapsN)TYPE_CHECKINGAnyCallableLiteralUnioncastfinaloverload)algoslib)NDArrayBacked)
BaseOffsetIncompatibleFrequencyNaTNaTTypePeriod
ResolutionTick	Timedelta	Timestampadd_overflowsafeastype_overflowsafeget_unit_from_dtypeiNaTints_to_pydatetimeints_to_pytimedeltaperiods_per_day	to_offset)RoundToround_nsint64)compare_mismatched_resolutions)get_unit_for_round)integer_op_not_supported)	ArrayLikeAxisIntDatetimeLikeScalarDtypeDtypeObjFInterpolateOptionsNpDtypePositionalIndexer2DPositionalIndexerTupleScalarIndexerSelfSequenceIndexerTimeAmbiguousTimeNonexistentnpt)function)AbstractMethodErrorInvalidComparisonPerformanceWarning)AppenderSubstitutioncache_readonly)find_stack_level)'construct_1d_object_array_from_listlike)is_all_stringsis_integer_dtypeis_list_likeis_object_dtypeis_string_dtypepandas_dtype)
ArrowDtypeCategoricalDtypeDatetimeTZDtypeExtensionDtypePeriodDtype)ABCCategoricalABCMultiIndex)is_valid_na_for_dtypeisna)
algorithmsmissingnanopsops)isin	map_arrayunique1d)datetimelike_accumulations)OpsMixin)NDArrayBackedExtensionArrayravel_compat)ArrowExtensionArray)ExtensionArray)IntegerArray)arrayensure_wrapped_if_datetimelikeextract_array)check_array_indexercheck_setitem_lengths)unpack_zerodim_and_defer)invalid_comparisonmake_invalid_op)frequencies)IteratorSequenceIndex)DatetimeArrayPeriodArrayTimedeltaArrayc                :    [        U 5      n[        U 5      " U5      $ N)re   rc   )op_nameops     Q/var/www/html/env/lib/python3.13/site-packages/pandas/core/arrays/datetimelike.py_make_unpacked_invalid_oprs      s    		!B#G,R00    c                L   ^  [        T 5      U 4S j5       n[        [        U5      $ )z
For PeriodArray methods, dispatch to DatetimeArray and re-wrap the results
in PeriodArray.  We cannot use ._ndarray directly for the affected
methods because the i8 data has different semantics on NaT values.
c                V  > [        U R                  [        5      (       d  T" U /UQ70 UD6$ U R                  S5      nT" U/UQ70 UD6nU[        L a  [        $ [        U[
        5      (       a  U R                  UR                  5      $ UR                  S5      nU R                  U5      $ )NM8[ns]i8)	
isinstancedtyperK   viewr   r   	_box_func_value_from_backing_data)selfargskwargsarrresultres_i8meths         rr   new_meth"_period_dispatch.<locals>.new_meth   s    $**k22.t.v..ii!c+D+F+S=J	**>>&--00T"&&v..rt   )r   r   r-   )r   r   s   ` rr   _period_dispatchr      s*     4[/ / 8rt   c                  p  ^  \ rS rSr% SrS\S'   S\S'   S\S'   S	\S
'   S\S'   \SqS j5       r Sr     SsS jjr\	StS j5       r
SuS jr    SvS jrSwS jrS rSxS jrSyS jr\	SzS j5       rSSS.   S{S jjrS|S}S jjr S~     SS jjr\SS j5       r\    SS j5       rSU 4S  jjrSS! jr      SU 4S" jjrSS# jrSSU 4S% jjjr\SS& j5       r\SS' j5       r\SS( j5       r\SSS) jj5       rSSU 4S* jjjrS+ rSS$S,.   SS- jjrS|SS. jjrS|SS/ jjrS0 r \!SS1 j5       r"\#SS2 j5       r$SS3 jr%SS4 jr&\	SS5 j5       r'\	SqS6 j5       r(\)S4   SS7 jjr*\	SS8 j5       r+\	SS9 j5       r,\	SS: j5       r-\	SS; j5       r.\	SqS< j5       r/\	SqS= j5       r0\	SqS> j5       r1S? r2\3" S@5      r4\3" SA5      r5\3" SB5      r6\3" SC5      r7\3" SD5      r8\3" SE5      r9\3" SF5      r:\3" SG5      r;\3" SH5      r<\3" SI5      r=\3" SJ5      r>\3" SK5      r?\!  SSL j5       r@\!SSM j5       rA\!SSN j5       rB\!SSO j5       rC\!    SSP j5       rD\!SSQ j5       rE\!SSR j5       rF\!SSS j5       rGST rHSU rISSV jrJ\!SSW j5       rK\!SX 5       rL\!SY 5       rM\!SSZ j5       rN\!SS[ j5       rOS$S\.SS] jjrP\Q" S^5      S_ 5       rRS` rS\Q" Sa5      Sb 5       rTSc rUSSd jrVSSe jrW\X      SU 4Sf jj5       rY\XSS$Sg.SSh jj5       rZ\XSS$Sg.SSi jj5       r[S$SjSk.SSl jjr\\XSS$Sg.SSm jj5       r]SSSn jjr^          SSo jr_Spr`U =ra$ )DatetimeLikeArrayMixin   z
Shared Base/Mixin class for DatetimeArray, TimedeltaArray, PeriodArray

Assumes that __new__/__init__ defines:
    _ndarray

and that inheriting subclass implements:
    freq
ztuple[str, ...]_infer_matcheszCallable[[DtypeObj], bool]_is_recognized_dtypeztuple[type, ...]_recognized_scalars
np.ndarray_ndarrayBaseOffset | Nonefreqc                    g)NT r   s    rr   _can_hold_na#DatetimeLikeArrayMixin._can_hold_na   s    rt   NFc                    [        U 5      ero   r9   )r   datarz   r   copys        rr   __init__DatetimeLikeArrayMixin.__init__   s     "$''rt   c                    [        U 5      e)z{
The scalar associated with this datelike

* PeriodArray : Period
* DatetimeArray : Timestamp
* TimedeltaArray : Timedelta
r   r   s    rr   _scalar_type#DatetimeLikeArrayMixin._scalar_type   s     "$''rt   c                    [        U 5      e)a  
Construct a scalar type from a string.

Parameters
----------
value : str

Returns
-------
Period, Timestamp, or Timedelta, or NaT
    Whatever the type of ``self._scalar_type`` is.

Notes
-----
This should call ``self._check_compatible_with`` before
unboxing the result.
r   r   values     rr   _scalar_from_string*DatetimeLikeArrayMixin._scalar_from_string       $ "$''rt   c                    [        U 5      e)aD  
Unbox the integer value of a scalar `value`.

Parameters
----------
value : Period, Timestamp, Timedelta, or NaT
    Depending on subclass.

Returns
-------
int

Examples
--------
>>> arr = pd.array(np.array(['1970-01-01'], 'datetime64[ns]'))
>>> arr._unbox_scalar(arr[0])
numpy.datetime64('1970-01-01T00:00:00.000000000')
r   r   s     rr   _unbox_scalar$DatetimeLikeArrayMixin._unbox_scalar   s    * "$''rt   c                    [        U 5      e)a  
Verify that `self` and `other` are compatible.

* DatetimeArray verifies that the timezones (if any) match
* PeriodArray verifies that the freq matches
* Timedelta has no verification

In each case, NaT is considered compatible.

Parameters
----------
other

Raises
------
Exception
r   r   others     rr   _check_compatible_with-DatetimeLikeArrayMixin._check_compatible_with  r   rt   c                    [        U 5      e)z9
box function to get object from internal representation
r   )r   xs     rr   r|    DatetimeLikeArrayMixin._box_func-  s     "$''rt   c                @    [         R                  " XR                  SS9$ )z!
apply box func to passed values
F)convert)r   	map_inferr|   )r   valuess     rr   _box_values"DatetimeLikeArrayMixin._box_values3  s     }}V^^UCCrt   c                   ^  T R                   S:  a  U 4S j[        [        T 5      5       5       $ U 4S jT R                   5       $ )N   c              3  .   >#    U  H
  nTU   v   M     g 7fro   r   ).0nr   s     rr   	<genexpr>2DatetimeLikeArrayMixin.__iter__.<locals>.<genexpr>;  s     6%5DG%5s   c              3  F   >#    U  H  nTR                  U5      v   M     g 7fro   )r|   )r   vr   s     rr   r   r   =  s     9y!DNN1%%ys   !)ndimrangelenasi8r   s   `rr   __iter__DatetimeLikeArrayMixin.__iter__9  s1    99q=6U3t9%5669tyy99rt   c                8    U R                   R                  S5      $ )za
Integer representation of the values.

Returns
-------
ndarray
    An ndarray with int64 dtype.
rx   )r   r{   r   s    rr   r   DatetimeLikeArrayMixin.asi8?  s     }}!!$''rt   r   )na_repdate_formatc                   [        U 5      e)zT
Helper method for astype when converting to strings.

Returns
-------
ndarray[str]
r   )r   r   r   s      rr   _format_native_types+DatetimeLikeArrayMixin._format_native_typesO  s     "$''rt   c                    SR                   $ )Nz'{}')format)r   boxeds     rr   
_formatter!DatetimeLikeArrayMixin._formatter[  s    }}rt   c                ~    [        U5      (       a"  [        R                  " [        U 5      [        S9$ U R
                  $ )Nrz   )rD   npr^   listobjectr   )r   rz   r   s      rr   	__array__ DatetimeLikeArrayMixin.__array__b  s.     5!!88DJf55}}rt   c                    g ro   r   r   items     rr   __getitem__"DatetimeLikeArrayMixin.__getitem__j      rt   c                    g ro   r   r   s     rr   r   r   n  s    
 	rt   c                   > [        S[        TU ]	  U5      5      n[        R                  " U5      (       a  U$ [        [
        U5      nU R                  U5      Ul        U$ )zz
This getitem defers to the underlying array, which by-definition can
only handle list-likes, slices, and integer scalars
zUnion[Self, DTScalarOrNaT])r   superr   r   	is_scalarr3   _get_getitem_freq_freq)r   keyr   	__class__s      rr   r   r   u  sU     2EG4G4LM==  M $'F--c2rt   c                n   [        U R                  [        5      nU(       a  U R                  nU$ U R                  S:w  a  SnU$ [        X5      nSn[        U[        5      (       aD  U R                  b(  UR                  b  UR                  U R                  -  nU$ U R                  n U$ U[        L a  U R                  nU$ [        R                  " U5      (       aY  [        R                  " UR                  [        R                  5      5      n[        U[        5      (       a  U R!                  U5      $ U$ )zL
Find the `freq` attribute to assign to the result of a __getitem__ lookup.
r   N)ry   rz   rK   r   r   ra   slicestepEllipsiscomis_bool_indexerr   maybe_booleans_to_slicer{   r   uint8r   )r   r   	is_periodr   new_keys        rr   r   (DatetimeLikeArrayMixin._get_getitem_freq  s
    tzz;7	99D& % YY!^D"  &d0CD#u%%99(SXX-A88dii/D   99D   yy
 	 $$S))55chhrxx6HIgu--11'::rt   c                l   > [        XU 5      n[        TU ]	  X5        U(       a  g U R                  5         g ro   )rb   r   __setitem___maybe_clear_freq)r   r   r   no_opr   s       rr   r   "DatetimeLikeArrayMixin.__setitem__  s2     &c$7 	C' rt   c                    g ro   r   r   s    rr   r   (DatetimeLikeArrayMixin._maybe_clear_freq  s     	rt   Tc                  > [        U5      nU[        :X  a  U R                  R                  S:X  a:  [	        SU 5      n U R
                  n[        UU R                  SU R                  S9nU$ U R                  R                  S:X  a  [        U R                  SS9$ U R                  U R
                  R                  5       5      R                  U R                  5      $ [        U[         5      (       a  ["        TU ]I  XS9$ ['        U5      (       a  U R)                  5       $ UR                  S	;   aU  U R
                  nU[*        R,                  :w  a  [/        S
U R                   SU S35      eU(       a  UR1                  5       nU$ UR                  S;   a  U R                  U:w  d  UR                  S:X  a&  S[3        U 5      R4                   SU 3n[/        U5      e[*        R6                  " XS9$ )NMrk   	timestamp)tzboxresomT)r   r   iuzConverting from z to z? is not supported. Do obj.astype('int64').astype(dtype) insteadmMfzCannot cast z
 to dtype r   )rF   r   rz   kindr   r   r   r   _cresor    r   r   ravelreshapeshapery   rJ   r   astyperE   r   r   int64	TypeErrorr   type__name__asarray)r   rz   r   i8data	convertedr   msgr   s          rr   r
  DatetimeLikeArrayMixin.astype  s   
 U#F?zz#%OT2 .ww#		 ! C'*4==dCC##DIIOO$56>>tzzJJ~..7>%>33U##,,..ZZ4 YYF &tzzl$ug >C C 
 MjjD TZZ5%8UZZ3=N !d!4!4 5ZwGCC. ::d00rt   c                    g ro   r   r   s    rr   r{   DatetimeLikeArrayMixin.view  r   rt   c                    g ro   r   r   rz   s     rr   r{   r    r   rt   c                    g ro   r   r  s     rr   r{   r    r   rt   c                    g ro   r   r  s     rr   r{   r    r   rt   c                "   > [         TU ]  U5      $ ro   )r   r{   )r   rz   r   s     rr   r{   r    s     w|E""rt   c                   [        U[        5      (       a   U R                  U5      n[        XR                  5      (       d	  U[        L a%  U R                  U5      n U R                  U5        U$ [        U5      (       d  [        U5      e[        U5      [        U 5      :w  a  [        S5      e U R                  USS9nU R                  U5        U$ ! [        [        4 a    [        U5      ef = f! [        [        4 a  n[        U5      UeS nAff = f! [        [        4 a2  n[        [        USS 5      5      (       a   S nAU$ [        U5      UeS nAff = f)NzLengths must matchT)allow_objectrz   )ry   strr   
ValueErrorr   r:   r   r   r   r   r  rC   r   _validate_listlikerD   getattr)r   r   errs      rr   _validate_comparison_value1DatetimeLikeArrayMixin._validate_comparison_value  sT   eS!!/007
 e5566%3,%%e,E8++E2, # e$$#E**Z3t9$122<//D/I++E2 ;  56 /'../ 45 8'.C78 45 <"75'4#@AA  ,E2;<sA   C C1 /!D C.1DDDE%EEE)allow_listlikeunboxc               D   [        XR                  5      (       a  O[        U[        5      (       a   U R                  U5      nO[        XR                  5      (       a  [        nOt[        U5      (       a  U R                  X5      n[        U5      e[        XR                  5      (       a  U R                  U5      nOU R                  X5      n[        U5      eU(       d  U$ U R                  U5      $ ! [         a"  nU R                  X5      n[        U5      UeSnAff = f)a  
Validate that the input value can be cast to our scalar_type.

Parameters
----------
value : object
allow_listlike: bool, default False
    When raising an exception, whether the message should say
    listlike inputs are allowed.
unbox : bool, default True
    Whether to unbox the result before returning.  Note: unbox=False
    skips the setitem compatibility check.

Returns
-------
self._scalar_type or NaT
N)ry   r   r  r   r  _validation_error_messager  rN   rz   r   rO   r   r   )r   r   r$  r%  r!  r  s         rr   _validate_scalar'DatetimeLikeArrayMixin._validate_scalar0  s    0 e..//s##.007
 #5**55E%[[ 00GCC. 7788 %%e,E 00GCC.  L!!%((9  .44UKn#-.s   C3 3
D=DDc                "   [        US5      (       a!  [        USS5      S:  a  UR                   S3nOS[        U5      R                   S3nU(       a  SU R
                  R                   SU S3nU$ SU R
                  R                   S	U S3nU$ )
z
Construct an exception message on validation error.

Some methods allow only scalar inputs, while others allow either scalar
or listlike.

Parameters
----------
allow_listlike: bool, default False

Returns
-------
str
rz   r   r   z array'zvalue should be a 'z!', 'NaT', or array of those. Got z	 instead.z' or 'NaT'. Got )hasattrr   rz   r  r  r   )r   r   r$  msg_gotr  s        rr   r'  0DatetimeLikeArrayMixin._validation_error_messagem  s     5'""wufa'@1'DV,G$u+../q1G%d&7&7&@&@%A B**1)=  
 &d&7&7&@&@%A Biy*  
rt   c                H   [        U[        U 5      5      (       a=  U R                  R                  S;   a!  U(       d  UR	                  U R
                  SS9nU$ [        U[        5      (       a2  [        U5      S:X  a#  [        U 5      R                  / U R                  S9$ [        US5      (       aS  UR                  [        :X  a?  [        R                  " U5      U R                  ;   a   [        U 5      R                  U5      n[#        USS9n[%        U5      n[#        USS9n['        U5      (       a#   [        U 5      R                  XR                  S9n[        UR                  [(        5      (       a>  UR*                  R                  U R                  :X  a  UR-                  5       n[#        USS9nU(       a  [/        UR                  5      (       a  OF[        U 5      R1                  UR                  5      (       d  U R!                  US5      n[        U5      eU R                  R                  S;   a!  U(       d  UR	                  U R
                  SS9nU$ ! [        [        4 a)    U(       a  Us $ U R!                  US5      n[        U5      ef = f! [         a     GNKf = f)	Nr  Fround_okr   r   rz   Textract_numpy)ry   r  rz   r  as_unitunitr   r   _from_sequencer,  r   r   infer_dtyper   r  r  r'  r`   pd_arrayrA   rH   
categories_internal_get_valuesrD   r   )r   r   r  r  s       rr   r  )DatetimeLikeArrayMixin._validate_listlike  s   eT$Z((zz$&|dii%@LeT""s5zQ:,,Rtzz,BB5'""u{{f'< u%)<)<<) J55e<E e48e48%   T
11%zz1J ekk#344%%3224%e4@OEKK88d00==00=CC. ::??d"<MM$))eM<EO #I. )#$88EC#C.(	)&  s$   )I 3"J J2J
J! J!c                    [        U5      (       a  U R                  U5      nOU R                  USS9$ U R                  U5      $ )NT)r$  )rC   r  r(  _unboxr   s     rr   _validate_setitem_value.DatetimeLikeArrayMixin._validate_setitem_value  sB    ++E2E((t(DD{{5!!rt   c                    [         R                  " U5      (       a  U R                  U5      nU$ U R                  U5        UR                  nU$ )zJ
Unbox either a scalar with _unbox_scalar or an instance of our own type.
)r   r   r   r   r   r   s     rr   r=  DatetimeLikeArrayMixin._unbox  sH    
 ==&&u-E
  ''.NNErt   c                    SSK Jn  [        XUS9nU" U5      n[        U[        5      (       a  UR                  5       $ UR                  $ )Nr   ri   )	na_action)pandasrj   rU   ry   rM   to_numpyr^   )r   mapperrC  rj   r   s        rr   mapDatetimeLikeArrayMixin.map  s>     49=vfm,,??$$<<rt   c                   UR                   R                  S;   a#  [        R                  " U R                  [
        S9$ [        U5      n[        U[        U 5      5      (       Gd  / SQnUR                   [        :X  a  [        R                  " USU R                   S9nUR                   [        :w  a  U R                  U5      $ [        R                  " USS9nX2;  aO  US:X  a  OHS	U;   a  [        U R                  [        5      U5      $ [        R                  " U R                  [
        S9$  [        U 5      R                  U5      n[         R"                  " S
U R                    S3[$        ['        5       S9  U R                   R                  S;   a'  [+        SU 5      n UR-                  U R.                  5      n U R1                  U5        [        U R4                  UR4                  5      $ ! [(         a"    [        U R                  [        5      U5      s $ f = f! [2        [(        4 a&    [        R                  " U R                  [
        S9s $ f = f)z
Compute boolean array of whether each value is found in the
passed set of values.

Parameters
----------
values : np.ndarray or ExtensionArray

Returns
-------
ndarray[bool]
fiucr   )r   timedelta64r   
datetime64dateperiodT)convert_non_numericdtype_if_all_natFskipnastringmixedz"The behavior of 'isin' with dtype=z and castable values (e.g. strings) is deprecated. In a future version, these will not be considered matching by isin. Explicitly cast to the appropriate dtype before calling isin instead.
stacklevelr  DatetimeArray | TimedeltaArray)rz   r  r   zerosr	  boolr_   ry   r  r   r   maybe_convert_objectsrT   r7  r
  r6  warningswarnFutureWarningr?   r  r   r4  r5  r   r  r   )r   r   	inferableinferreds       rr   rT   DatetimeLikeArrayMixin.isin  s    <<&88DJJd33/7&$t*--I ||v%22(,%)ZZ
 <<6)99V,,??6%@,8+ H,#DKK$7@@!xx

$??d226: 8 E, ,
 "/1	 ::??d"8$?D ^^DII.F	4 ''/ DIIv{{++?  9DKK/8892 :& 	488DJJd33	4s$   +G( 7H ()HH3IIc                    U R                   $ ro   )_isnanr   s    rr   rO   DatetimeLikeArrayMixin.isnaA  s    {{rt   c                (    U R                   [        :H  $ )z
return if each value is nan
)r   r   r   s    rr   rb  DatetimeLikeArrayMixin._isnanD  s    
 yyD  rt   c                H    [        U R                  R                  5       5      $ )z:
return if I have any nans; enables various perf speedups
)rY  rb  anyr   s    rr   _hasnaDatetimeLikeArrayMixin._hasnaK  s    
 DKKOO%&&rt   c                    U R                   (       aL  U(       a  UR                  U5      nUc  [        R                  n[        R                  " XR
                  U5        U$ )a  
Parameters
----------
result : np.ndarray
fill_value : object, default iNaT
convert : str, dtype or None

Returns
-------
result : ndarray with values replace by the fill_value

mask the result if needed, convert to the provided dtype if its not
None

This is an internal routine.
)rh  r
  r   nanputmaskrb  )r   r   
fill_valuer   s       rr   _maybe_mask_results*DatetimeLikeArrayMixin._maybe_mask_resultsR  sB    & ;;w/!VV
JJv{{J7rt   c                J    U R                   c  gU R                   R                  $ )a  
Return the frequency object as a string if it's set, otherwise None.

Examples
--------
For DatetimeIndex:

>>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00"], freq="D")
>>> idx.freqstr
'D'

The frequency can be inferred if there are more than 2 points:

>>> idx = pd.DatetimeIndex(["2018-01-01", "2018-01-03", "2018-01-05"],
...                        freq="infer")
>>> idx.freqstr
'2D'

For PeriodIndex:

>>> idx = pd.PeriodIndex(["2023-1", "2023-2", "2023-3"], freq="M")
>>> idx.freqstr
'M'
N)r   freqstrr   s    rr   rq  DatetimeLikeArrayMixin.freqstrp  s!    4 99yy   rt   c                r    U R                   S:w  a  g [        R                  " U 5      $ ! [         a     gf = f)a  
Tries to return a string representing a frequency generated by infer_freq.

Returns None if it can't autodetect the frequency.

Examples
--------
For DatetimeIndex:

>>> idx = pd.DatetimeIndex(["2018-01-01", "2018-01-03", "2018-01-05"])
>>> idx.inferred_freq
'2D'

For TimedeltaIndex:

>>> tdelta_idx = pd.to_timedelta(["0 days", "10 days", "20 days"])
>>> tdelta_idx
TimedeltaIndex(['0 days', '10 days', '20 days'],
               dtype='timedelta64[ns]', freq=None)
>>> tdelta_idx.inferred_freq
'10D'
r   N)r   rf   
infer_freqr  r   s    rr   inferred_freq$DatetimeLikeArrayMixin.inferred_freq  s:    0 99>	))$// 		s   ) 
66c                p    U R                   nUc  g  [        R                  " U5      $ ! [         a     g f = fro   )rq  r   get_reso_from_freqstrKeyError)r   rq  s     rr   _resolution_obj&DatetimeLikeArrayMixin._resolution_obj  s;    ,,?	33G<< 		s   ( 
55c                .    U R                   R                  $ )z?
Returns day, hour, minute, second, millisecond or microsecond
)rz  attrnamer   s    rr   
resolution!DatetimeLikeArrayMixin.resolution  s     ##,,,rt   c                F    [         R                  " U R                  SS9S   $ )NTtimeliker   r   is_monotonicr   r   s    rr   _is_monotonic_increasing/DatetimeLikeArrayMixin._is_monotonic_increasing      !!$))d;A>>rt   c                F    [         R                  " U R                  SS9S   $ )NTr  r   r  r   s    rr   _is_monotonic_decreasing/DatetimeLikeArrayMixin._is_monotonic_decreasing  r  rt   c                v    [        [        U R                  R                  S5      5      5      U R                  :H  $ )NK)r   rV   r   r  sizer   s    rr   
_is_unique!DatetimeLikeArrayMixin._is_unique  s(    8DIIOOC012dii??rt   c                   U R                   S:  aY  [        USS 5      U R                  :X  a>  U" U R                  5       UR                  5       5      R	                  U R                  5      $  U R                  U5      n[        USS 5      n[        U5      (       aA  [        R                  " U[        R                  " U R                  [        5      5      U5      nU$ U[        L a]  U[         R"                  L a%  [        R$                  " U R                  [&        S9nU$ [        R(                  " U R                  [&        S9nU$ [+        U R,                  [.        5      (       d  [1        [2        U 5      n U R4                  UR4                  :w  aX  [+        U[7        U 5      5      (       d   UR9                  U R:                  SS9nO"URD                  n[C        U RD                  XR5      $ U RG                  U5      nU" U RD                  RI                  S5      URI                  S5      5      n[K        U5      nU RL                  U-  nURO                  5       (       a)  U[         R"                  L n	[        RP                  " XHU	5        U$ ! [         a    [        XU5      s $ f = f! [<         a9    [        R>                  " UR@                  5      n[C        U RD                  XR5      s $ f = f)Nr   r	  rz   r   Fr0  rx   ))r   r   r	  r  r  r"  r:   rd   rD   rS   comp_method_OBJECT_ARRAYr   r  r
  r   r   operatorneonesrY  rX  ry   rz   rK   r   TimelikeOpsr  r  r4  r5  r  r^   asm8r%   r   r=  r{   rO   rb  rg  rl  )
r   r   rq   rz   r   	other_arr
other_valso_maskmask
nat_results
             rr   _cmp_method"DatetimeLikeArrayMixin._cmp_method  s5   99q=WUGT:djjHdjjlEKKM2::4::FF	733E:E w-5!! 11BJJt{{623UF MC<X[[ 48 M $**D9M$**k22T*D{{ell*!%d44 %dii% H !&I9$--WW[['
DMM&&t,jood.CDe{{V#88::x{{*JJJvZ0] ! 	7%d266	76 & $&HHUZZ$8	= MM9  s%   +I= $J =JJA KK__pow____rpow____mul____rmul____truediv____rtruediv____floordiv____rfloordiv____mod____rmod__
__divmod____rdivmod__c                    [        U[        5      (       a  UR                  nSnX#4$ [        U[        [        45      (       a  UR
                  nSnX#4$ UR                  nUR                  nX#4$ )z>
Get the int64 values and b_mask to pass to add_overflowsafe.
N)ry   r   ordinalr   r   r}   rb  r   )r   r   i8valuesr  s       rr   _get_i8_values_and_mask.DatetimeLikeArrayMixin._get_i8_values_and_mask  sq     eV$$}}HD ~ 	9566||HD
 ~ <<DzzH~rt   c                    [        U R                  [        5      (       a  U R                  $ [        R
                  " U5      (       d  g[        U R                  [        5      (       a  U R                  $ g)z@
Check if we can preserve self.freq in addition or subtraction.
N)ry   rz   rK   r   r   r   r   r   s     rr   _get_arithmetic_result_freq2DatetimeLikeArrayMixin._get_arithmetic_result_freq*  sO     djj+..99u%%		4((99rt   c                   [         R                  " U R                  S5      (       d7  [        S[	        U 5      R
                   S[	        U5      R
                   35      e[        SU 5      n SSKJn  SSK	J
n  U[        Ld   e[        U5      (       aY  U R                  [        R                  " 5       R                  SU R                    S	35      -   nUR"                  " XDR                  S
9$ [%        U5      nU R'                  U5      u  p[        SU 5      n U R)                  U5      u  pV[+        U R,                  [.        R0                  " USS
95      nUR3                  SU R                    S	35      nU" UR4                  U R                   S9nUR3                  SU R                    S	35      nU R7                  U5      n	UR"                  " XxU	S9$ )Nr   cannot add  and rm   r   rk   )tz_to_dtypezM8[]r   rx   r   r5  rz   r   )r   is_np_dtyperz   r  r  r  r   pandas.core.arraysrk   pandas.core.arrays.datetimesr  r   rO   r   to_datetime64r
  r5  _simple_newr   _ensure_matching_resosr  r   r   r   r  r{   r   r  )
r   r   rk   r  r   other_i8r  
res_valuesrz   new_freqs
             rr   _add_datetimelike_scalar/DatetimeLikeArrayMixin._add_datetimelike_scalar:  s   tzz3//d4j112%U8L8L7MN  $d+4<C;; ]]S%6%6%8%?%?#dii[PQ@R%SSF ,,V<<HH% 11%8$d+77>!$))RZZ-MN[[3tyyk!34
uxxdii8[[3tyyk!34
33E:((xPPrt   c                    [         R                  " U R                  S5      (       d7  [        S[	        U 5      R
                   S[	        U5      R
                   35      eX-   $ )Nr   r  r  )r   r  rz   r  r  r  r   s     rr   _add_datetime_arraylike.DatetimeLikeArrayMixin._add_datetime_arraylike\  sT    tzz3//d4j112%U8L8L7MN 
 |rt   c                    U R                   R                  S:w  a!  [        S[        U 5      R                   35      e[        SU 5      n [        U5      (       a	  U [        -
  $ [        U5      nU R                  U5      u  pU R                  U5      $ )Nr   "cannot subtract a datelike from a rk   )rz   r  r  r  r  r   rO   r   r   r  _sub_datetimelike)r   r   tss      rr   _sub_datetimelike_scalar/DatetimeLikeArrayMixin._sub_datetimelike_scalarf  s     ::??c!@dATAT@UVWWOT* ;;#:u..r2%%b))rt   c                   U R                   R                  S:w  a!  [        S[        U 5      R                   35      e[        U 5      [        U5      :w  a  [        S5      e[        SU 5      n U R                  U5      u  pU R                  U5      $ )Nr   r  $cannot add indices of unequal lengthrk   )
rz   r  r  r  r  r   r  r   r  r  r   s     rr   _sub_datetime_arraylike.DatetimeLikeArrayMixin._sub_datetime_arraylikey  s{    ::??c!@dATAT@UVWWt9E
"CDDOT*11%8%%e,,rt   c                   [        SU 5      n SSKJn   U R                  U5        U R                  U5      u  pV[        U R                  [        R                  " U* SS95      nUR                  SU R                   S	35      nU R                  U5      n	[        S
U	5      n	UR                   " XR"                  U	S9$ ! [         a2  n[        U5      R                  SS5      n[        U5      " U5      UeS nAff = f)Nrk   r   rm   comparesubtractrx   r   timedelta64[r  zTick | Noner  )r   r  rm   _assert_tzawareness_compatr  r  replacer  r  r   r   r   r  r{   r5  r  r  rz   )
r   r   rm   r!  new_messager  r  r  res_m8r  s
             rr   r  (DatetimeLikeArrayMixin._sub_datetimelike  s    OT*5	2++E2
  77>%diiXIT1RS
<		{!!<=33E:x0))&8TT  	2c(**9jAKs)K(c1	2s   B9 9
C5-C00C5c                0   [         R                  " U R                  S5      (       d!  [        S[	        U 5      R
                   35      eSSKJn  [        R                  " UR                  U R                  5      n[        UR                  5      nU" X4S9nXP-   $ )Nr   zcannot add Period to a r   )rl   r   )r   r  rz   r  r  r  pandas.core.arrays.periodrl   r   broadcast_tor  r	  rK   r   )r   r   rl   i8valsrz   parrs         rr   _add_period"DatetimeLikeArrayMixin._add_period  sr    tzz3//5d4j6I6I5JKLL 	:

;EJJ'6/{rt   c                    [        U 5      ero   r   )r   offsets     rr   _add_offset"DatetimeLikeArrayMixin._add_offset  s    !$''rt   c                   [        U5      (       ay  [        R                  " U R                  SS9R	                  U R
                  R                  5      nUR                  [        5        [        U 5      R                  X R                  S9$ [        SU 5      n [        U5      nU R                  U5      u  pU R                  U5      $ )zC
Add a delta of a timedeltalike

Returns
-------
Same type as self
rx   r   rW  )rO   r   emptyr	  r{   r   rz   fillr   r  r  r   r   r  _add_timedeltalike)r   r   
new_valuess      rr   _add_timedeltalike_scalar0DatetimeLikeArrayMixin._add_timedeltalike_scalar  s     ;;$**D9>>t}}?R?RSJOOD!:))*JJ)GG 4d;% 11%8&&u--rt   c                    [        U 5      [        U5      :w  a  [        S5      e[        SU 5      n U R                  U5      u  pU R	                  U5      $ )zD
Add a delta of a TimedeltaIndex

Returns
-------
Same type as self
r  rW  )r   r  r   r  r  r   s     rr   _add_timedelta_arraylike/DatetimeLikeArrayMixin._add_timedelta_arraylike  sP     t9E
"CDD4d;11%8&&u--rt   c                D   [        SU 5      n U R                  U5      u  p#[        U R                  [        R
                  " USS95      nUR                  U R                  R                  5      nU R                  U5      n[        U 5      R                  XPR                  US9$ )NrW  rx   r   r  )r   r  r   r   r   r  r{   r   rz   r  r  r  )r   r   r  r  r  r  r  s          rr   r  )DatetimeLikeArrayMixin._add_timedeltalike  s    4d;77>%diiHD1QR
__T]]%8%89
33E:
 Dz%%jjx & 
 	
rt   c                   [        U R                  [        5      (       a;  [        S[	        U 5      R
                   S[	        [        5      R
                   35      e[        SU 5      n [        R                  " U R                  [        R                  S9nUR                  [        5        UR                  U R                  R                  5      n[	        U 5      R!                  XR                  SS9$ )z
Add pd.NaT to self
zCannot add r  zTimedeltaArray | DatetimeArrayr   Nr  )ry   rz   rK   r  r  r  r   r   r   r  r	  r  r  r   r{   r   r  r   r   s     rr   _add_natDatetimeLikeArrayMixin._add_nat  s    
 djj+..d4j112%S	8J8J7KL  4d; $**BHH5DT]]001 Dz%%**4 & 
 	
rt   c                2   [         R                  " U R                  [         R                  S9nUR	                  [
        5        U R                  R                  S;   a+  [        SU 5      n UR                  SU R                   S35      $ UR                  S5      $ )z
Subtract pd.NaT from self
r   r  zDatetimeArray| TimedeltaArrayr  r  ztimedelta64[ns])r   r  r	  r  r  r   rz   r  r   r{   r5  r  s     rr   _sub_natDatetimeLikeArrayMixin._sub_nat  sq     $**BHH5D::??d"7>D;;dii[:;;;;011rt   c                8   [        U R                  [        5      (       d7  [        S[	        U5      R
                   S[	        U 5      R
                   35      e[        SU 5      n U R                  U5        U R                  U5      u  p#[        U R                  [        R                  " U* SS95      n[        R                  " U Vs/ s H  oPR                  R                  U-  PM     sn5      nUc  U R                   nOU R                   U-  n["        Xg'   U$ s  snf )Ncannot subtract  from rl   rx   r   )ry   rz   rK   r  r  r  r   r   r  r   r   r   r  r^   r   baserb  r   )r   r   r  r  new_i8_datar   new_datar  s           rr   _sub_periodlike&DatetimeLikeArrayMixin._sub_periodlike  s     $**k22"4;#7#7"8tDz?R?R>ST  M4(##E*77>&tyy"**hYd2ST88EAYY^^a/EF>;;D ;;'D Fs   "Dc                   U[         R                  [         R                  4;   d   e[        U5      S:X  a  U R                  S:X  a  U" XS   5      $ [
        R                  " S[        U 5      R                   S3[        [        5       S9  U R                  UR                  :X  d   U R                  UR                  45       eU" U R                  S5      [        R                  " U5      5      nU$ )a  
Add or subtract array-like of DateOffset objects

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

Returns
-------
np.ndarray[object]
    Except in fastpath case with length 1 where we operate on the
    contained scalar.
r   r   z)Adding/subtracting object-dtype array to z not vectorized.rU  O)r  addsubr   r   r[  r\  r  r  r;   r?   r	  r
  r   r  )r   r   rq   r  s       rr   _addsub_object_array+DatetimeLikeArrayMixin._addsub_object_array%  s      hllHLL1111u:?tyyA~ d!H%%7Dz""##35')		
 zzU[[(C4::u{{*CC(C("**U*;<
rt   rQ  c                   US;  a  [        SU S[        U 5       35      e[        [        U5      nU" U R	                  5       4SU0UD6n[        U 5      R                  XPR                  S9$ )N>   cummaxcumminzAccumulation z not supported for rR  r   )r  r  r   rW   r   r  rz   )r   namerR  r   rq   r   s         rr   _accumulate"DatetimeLikeArrayMixin._accumulateI  sk    ++mD61DT$ZLQRR/6DIIK99&9Dz%%fJJ%??rt   __add__c                V   [        USS 5      n[        U5      nU[        L a  U R                  5       nGO[	        U[
        [        [        R                  45      (       a  U R                  U5      nGO[[	        U[        5      (       a  U R                  U5      nGO3[	        U[        [        R                  45      (       a  U R                  U5      nGO[	        U[        5      (       a9  [         R"                  " U R$                  S5      (       a  U R'                  U5      nGO[         R(                  " U5      (       an  [	        U R$                  [*        5      (       d  [-        U 5      e[/        SU 5      nUR1                  XR$                  R2                  -  [4        R6                  5      nGO$[         R"                  " US5      (       a  U R9                  U5      nO[;        U5      (       a!  U R=                  U[4        R6                  5      nO[         R"                  " US5      (       d  [	        U[>        5      (       a  U RA                  U5      $ [C        U5      (       am  [	        U R$                  [*        5      (       d  [-        U 5      e[/        SU 5      nUR1                  XR$                  R2                  -  [4        R6                  5      nO[D        $ [	        U[        RF                  5      (       a>  [         R"                  " UR$                  S5      (       a  SSK$J%n  URL                  " U5      $ U$ )Nrz   r   rl   r   r   r  )'r   r_   r   r  ry   r   r   r   rK  r  r   r  r   rL  r  r   r   r  rz   r  
is_integerrK   r'   r   _addsub_int_array_or_scalar_nr  r  r  rD   r  rI   r  rB   NotImplementedndarrayr  rm   r6  r   r   other_dtyper   objrm   s         rr   r  DatetimeLikeArrayMixin.__add__R  s7   eWd3.u5 C<]]_Fi@AA33E:Fz**%%e,F"--8992259Fv&&3??4::s+K+K%%e,F^^E"" djj+66.t44}d+C44UYY\\5I8<<XF __[#..2259F[))..uhllCF__[#..*3
 3
 //66k**djj+66.t44}d+C44UYY\\5I8<<XF "!fbjj))coofllC.P.P9!0088rt   c                $    U R                  U5      $ ro   )r  r   s     rr   __radd__DatetimeLikeArrayMixin.__radd__  s    ||E""rt   __sub__c                b   [        USS 5      n[        U5      nU[        L a  U R                  5       nGO[	        U[
        [        [        R                  45      (       a  U R                  U* 5      nGO`[	        U[        5      (       a  U R                  U* 5      nGO7[	        U[        [        R                  45      (       a  U R                  U5      nGO[        R                   " U5      (       an  [	        U R"                  [$        5      (       d  ['        U 5      e[)        SU 5      nUR+                  XR"                  R,                  -  [.        R0                  5      nGOv[	        U[2        5      (       a  U R5                  U5      nGON[        R6                  " US5      (       a  U R9                  U* 5      nGO[;        U5      (       a!  U R=                  U[.        R0                  5      nO[        R6                  " US5      (       d  [	        U[>        5      (       a  U RA                  U5      nO[	        U[$        5      (       a  U R5                  U5      nO[C        U5      (       am  [	        U R"                  [$        5      (       d  ['        U 5      e[)        SU 5      nUR+                  XR"                  R,                  -  [.        R0                  5      nO[D        $ [	        U[        RF                  5      (       a>  [        R6                  " UR"                  S5      (       a  SSK$J%n  URL                  " U5      $ U$ )Nrz   rl   r   r   r   r  )'r   r_   r   r  ry   r   r   r   rK  r  r   r  r   rL  r  r   r  rz   rK   r'   r   r  r  r  r  r   r   r  r  rD   r  rI   r  rB   r  r  r  rm   r6  r  s         rr   r  DatetimeLikeArrayMixin.__sub__  sE   eWd3.u5 C<]]_Fi@AA33UF;Fz**%%uf-F"--8992259F^^E"" djj+66.t44}d+C44UYY\\5I8<<XFv&&))%0F __[#..22E6:F[))..uhllCF__[#..*3
 3
 11%8F[11))%0Fk**djj+66.t44}d+C44UYY\\5I8<<XF "!fbjj))coofllC.P.P9!0088rt   c                   [        USS 5      n[        R                  " US5      =(       d    [        U[        5      nU(       a  [        R                  " U R
                  S5      (       aZ  [        R                  " U5      (       a  [        U5      U -
  $ [        U[        5      (       d  SSK	J
n  UR                  " U5      nX-
  $ U R
                  R                  S:X  aO  [        US5      (       a>  U(       d7  [        S[        U 5      R                    S[        U5      R                    35      e[        U R
                  ["        5      (       aJ  [        R                  " US5      (       a.  [        S[        U 5      R                    SUR
                   35      e[        R                  " U R
                  S5      (       a  [%        SU 5      n U * U-   $ X-
  * $ )	Nrz   r   r   r   r  r  r  rm   )r   r   r  ry   rI   rz   r   r   r   r  rk   r6  r  r,  r  r  r  rK   r   )r   r   r  other_is_dt64rk   s        rr   __rsub__DatetimeLikeArrayMixin.__rsub__  sm   eWd3S9 
Z>
 S__TZZ== }}U## '$..e%;<<<%44U;<ZZ__#w(?(? "4:#6#6"7vd5k>R>R=ST  

K00S__[RU5V5V.tDz/B/B.C6%++WXX__TZZ--($/DEU?" rt   c                ~    X-   nUS S  U S S & [        U R                  [        5      (       d  UR                  U l        U $ ro   ry   rz   rK   r   r   r   r   r   s      rr   __iadd__DatetimeLikeArrayMixin.__iadd__  7    )Q$**k22DJrt   c                ~    X-
  nUS S  U S S & [        U R                  [        5      (       d  UR                  U l        U $ ro   r$  r%  s      rr   __isub__DatetimeLikeArrayMixin.__isub__  r(  rt   c                   > [         TU ]  XS9$ )N)qsinterpolation)r   	_quantile)r   r-  r.  r   s      rr   r/   DatetimeLikeArrayMixin._quantile  s     w B DDrt   axisrR  c                   [         R                  " SU5        [         R                  " XR                  5        [        R
                  " U R                  XS9nU R                  X5      $ )z
Return the minimum value of the Array or minimum along
an axis.

See Also
--------
numpy.ndarray.min
Index.min : Return the minimum value in an Index.
Series.min : Return the minimum value in a Series.
r   r1  )nvvalidate_minvalidate_minmax_axisr   rR   nanminr   _wrap_reduction_resultr   r2  rR  r   r   s        rr   minDatetimeLikeArrayMixin.min  I     	F#
ii0t}}4G**488rt   c                   [         R                  " SU5        [         R                  " XR                  5        [        R
                  " U R                  XS9nU R                  X5      $ )z
Return the maximum value of the Array or maximum along
an axis.

See Also
--------
numpy.ndarray.max
Index.max : Return the maximum value in an Index.
Series.max : Return the maximum value in a Series.
r   r1  )r4  validate_maxr6  r   rR   nanmaxr   r8  r9  s        rr   maxDatetimeLikeArrayMixin.max  r<  rt   r   )rR  r2  c                  [        U R                  [        5      (       a"  [        S[	        U 5      R
                   S35      e[        R                  " U R                  X!U R                  5       S9nU R                  X#5      $ )a  
Return the mean value of the Array.

Parameters
----------
skipna : bool, default True
    Whether to ignore any NaT elements.
axis : int, optional, default 0

Returns
-------
scalar
    Timestamp or Timedelta.

See Also
--------
numpy.ndarray.mean : Returns the average of array elements along a given axis.
Series.mean : Return the mean value in a Series.

Notes
-----
mean is only defined for Datetime and Timedelta dtypes, not for Period.

Examples
--------
For :class:`pandas.DatetimeIndex`:

>>> idx = pd.date_range('2001-01-01 00:00', periods=3)
>>> idx
DatetimeIndex(['2001-01-01', '2001-01-02', '2001-01-03'],
              dtype='datetime64[ns]', freq='D')
>>> idx.mean()
Timestamp('2001-01-02 00:00:00')

For :class:`pandas.TimedeltaIndex`:

>>> tdelta_idx = pd.to_timedelta([1, 2, 3], unit='D')
>>> tdelta_idx
TimedeltaIndex(['1 days', '2 days', '3 days'],
                dtype='timedelta64[ns]', freq=None)
>>> tdelta_idx.mean()
Timedelta('2 days 00:00:00')
zmean is not implemented for zX since the meaning is ambiguous.  An alternative is obj.to_timestamp(how='start').mean()r2  rR  r  )ry   rz   rK   r  r  r  rR   nanmeanr   rO   r8  )r   rR  r2  r   s       rr   meanDatetimeLikeArrayMixin.mean)  st    X djj+...tDz/B/B.C D7 7  MM$))+
 **488rt   c                   [         R                  " SU5        Ub$  [        U5      U R                  :  a  [	        S5      e[
        R                  " U R                  XS9nU R                  X5      $ )Nr   z abs(axis) must be less than ndimr1  )	r4  validate_medianabsr   r  rR   	nanmedianr   r8  r9  s        rr   medianDatetimeLikeArrayMixin.medianb  sZ    
2v&D	TYY 6?@@!!$--dJ**488rt   c                   S nU(       a  U R                  5       n[        R                  " U R                  S5      US9nUR                  U R                  R
                  5      n[        [        R                  U5      nU R                  U5      $ )Nrx   )r  )
rO   rP   moder{   r   rz   r   r   r  r~   )r   dropnar  i8modesnpmodess        rr   _modeDatetimeLikeArrayMixin._model  sf    99;D//$))D/=,,t}}223rzz7+&&w//rt   c                  U R                   nUR                  S:X  aE  US;   a  [        SU S35      eUS;   a)  [        R                  " SU SU S3[
        [        5       S	9  Oo[        U[        5      (       aE  US;   a  [        S
U S35      eUS;   a)  [        R                  " SU SU S3[
        [        5       S	9  OUS;   a  [        SU S35      eU R                  R                  S5      nSSKJn	  U	R                  U5      n
U	" XUS9nUR                  " U4UUUS S.UD6nUR                  UR                   ;   a  U$ UR                   S:X  d   eUS;   aw  SSKJn  [        U R                   [        5      (       a  [        S5      e['        SU 5      n SU R(                   S3nUR                  U5      nUR*                  " XR                   S9$ UR                  U R                  R                   5      nU R-                  U5      $ )Nr   )sumprodcumsumcumprodvarskewz!datetime64 type does not support z operations)rg  allr+  zh' with datetime64 dtypes is deprecated and will raise in a future version. Use (obj != pd.Timestamp(0)).z() instead.rU  zPeriod type does not support ze' with PeriodDtype is deprecated and will raise in a future version. Use (obj != pd.Period(0, freq)).)rV  rX  rZ  rY  z"timedelta64 type does not support rw   r   )WrappedCythonOp)howr  has_dropped_na)	min_countngroupscomp_idsr  )stdsemr  z-'std' and 'sem' are not valid for PeriodDtyperW  zm8[r  r   )rz   r  r  r[  r\  r]  r?   ry   rK   r   r{   pandas.core.groupby.opsr\  get_kind_from_how_cython_op_ndim_compatr]  cast_blocklistr  rm   r   r5  r  r~   )r   r]  r^  r_  r`  idsr   rz   npvaluesr\  r  rq   r  rm   	new_dtypes                  rr   _groupby_op"DatetimeLikeArrayMixin._groupby_opy  s    

::II"CC5 TUUn$u DDG5U!/1	 {++II"?uK PQQn$u GGJe;X!/1	 88"DSE UVV ==%%h/;005O..

 

 66R&&&  8+++. 9$**k22 OPP8$?Ddii[*I#3J!--j@P@PQQ__T]]%8%89
&&z22rt   r   returnrY  )NNF)rz   Dtype | Noner   rY  ro  None)ro  ztype[DatetimeLikeScalar])r   r  ro  DTScalarOrNaT)r   rr  ro  z)np.int64 | np.datetime64 | np.timedelta64)r   rr  ro  rq  ro  r   )ro  rg   )ro  znpt.NDArray[np.int64])r   zstr | floatro  npt.NDArray[np.object_])F)r   rY  )NN)rz   zNpDtype | Noner   zbool | Nonero  r   )r   r2   ro  rr  )r   z(SequenceIndexer | PositionalIndexerTuplero  r3   )r   r0   ro  zSelf | DTScalarOrNaT)ro  r   )r   z,int | Sequence[int] | Sequence[bool] | slicer   zNaTType | Any | Sequence[Any]ro  rq  ro  rq  T)r   rY  ro  r3   )rz   zLiteral['M8[ns]']ro  rk   )rz   zLiteral['m8[ns]']ro  rm   ).)rz   rp  ro  r(   ro   )r$  rY  r%  rY  )r$  rY  ro  r  )r  rY  )ro  z6np.int64 | np.datetime64 | np.timedelta64 | np.ndarray)r   r(   ro  npt.NDArray[np.bool_])ro  rx  )r   r   ro  r   )ro  z
str | None)ro  zResolution | Nonero  r  )ro  z@tuple[int | npt.NDArray[np.int64], None | npt.NDArray[np.bool_]])ro  rk   )r   rk   ro  rk   )r   zdatetime | np.datetime64ro  rm   )r   rk   ro  rm   )r   zTimestamp | DatetimeArrayro  rm   )r   r   ro  rl   )r   rm   )r   zTimedelta | TimedeltaArray)r   zPeriod | PeriodArrayro  rt  )r   rt  )r  r  rR  rY  ro  r3   )r-  znpt.NDArray[np.float64]r.  r  ro  r3   )r2  AxisInt | NonerR  rY  )rR  rY  r2  rz  )rO  rY  )
r]  r  r^  rY  r_  intr`  r{  rh  znpt.NDArray[np.intp])br  
__module____qualname____firstlineno____doc____annotations__r>   r   r   propertyr   r   r   r   r|   r   r   r   r   r   r   r   r   r   r   r   r
  r{   r"  r(  r'  r  r>  r   r=  rZ   rG  rT   rO   rb  rh  r   rn  rq  ru  rz  r~  r  r  r  r  rs   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  rc   r  r  r  r!  r&  r*  r   r/  r:  r@  rE  rK  rR  rk  __static_attributes____classcell__r   s   @rr   r   r      s    $#44))
  IN('(AE(	(
 ( (((("(	2(.(,(D: 
( 
(  (-$
($
(	 
( AE#2=	   6 
 "<!9! -! 
	!,
11 11f        # #"P  %;) 	;)
 ;)z>8t" 
 
" 	  	 P,j ! ! ' ' .24 	< ! !:  <   - - ? ? ? ? @ @5r (	2G(4H'	2G(4H+M:K,^<L,^<L-o>M'	2G(4H*<8J+M:K
	I $   Q QB   *-*	* *$ 
- 
- U U& 
 
(.(.$ 
 
  
 
, 2 2&  0 ! !F 8< @ i(5 )5n# i(5 )5n D E#E E 
	E E ,0 9 9" ,0 9 9" &*! 79r /3D 9 90M3 M3 	M3
 M3 M3 "M3 M3rt   r   c                  4    \ rS rSrSr\" SS9SS j5       rSrg)	DatelikeOpsi  zC
Common ops for DatetimeIndex/PeriodIndex, but not TimedeltaIndex.
zNhttps://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior)URLc                f    U R                  U[        R                  S9nUR                  [        SS9$ )a  
Convert to Index using specified date_format.

Return an Index of formatted strings specified by date_format, which
supports the same string format as the python standard library. Details
of the string format can be found in `python string format
doc <%(URL)s>`__.

Formats supported by the C `strftime` API but not by the python string format
doc (such as `"%%R"`, `"%%r"`) are not officially supported and should be
preferably replaced with their supported equivalents (such as `"%%H:%%M"`,
`"%%I:%%M:%%S %%p"`).

Note that `PeriodIndex` support additional directives, detailed in
`Period.strftime`.

Parameters
----------
date_format : str
    Date format string (e.g. "%%Y-%%m-%%d").

Returns
-------
ndarray[object]
    NumPy ndarray of formatted strings.

See Also
--------
to_datetime : Convert the given argument to datetime.
DatetimeIndex.normalize : Return DatetimeIndex with times to midnight.
DatetimeIndex.round : Round the DatetimeIndex to the specified freq.
DatetimeIndex.floor : Floor the DatetimeIndex to the specified freq.
Timestamp.strftime : Format a single Timestamp.
Period.strftime : Format a single Period.

Examples
--------
>>> rng = pd.date_range(pd.Timestamp("2018-03-10 09:00"),
...                     periods=3, freq='s')
>>> rng.strftime('%%B %%d, %%Y, %%r')
Index(['March 10, 2018, 09:00:00 AM', 'March 10, 2018, 09:00:01 AM',
       'March 10, 2018, 09:00:02 AM'],
      dtype='object')
)r   r   Fr  )r   r   rk  r
  r   )r   r   r   s      rr   strftimeDatelikeOps.strftime  s1    b **{266*R}}V%}00rt   r   N)r   r  ro  rt  )r  r|  r}  r~  r  r=   r  r  r   rt   rr   r  r    s%     *.1	.1rt   r  aO	  
    Perform {op} operation on the data to the specified `freq`.

    Parameters
    ----------
    freq : str or Offset
        The frequency level to {op} the index to. Must be a fixed
        frequency like 'S' (second) not 'ME' (month end). See
        :ref:`frequency aliases <timeseries.offset_aliases>` for
        a list of possible `freq` values.
    ambiguous : 'infer', bool-ndarray, 'NaT', default 'raise'
        Only relevant for DatetimeIndex:

        - 'infer' will attempt to infer fall dst-transition hours based on
          order
        - bool-ndarray where True signifies a DST time, False designates
          a non-DST time (note that this flag is only applicable for
          ambiguous times)
        - 'NaT' will return NaT where there are ambiguous times
        - 'raise' will raise an AmbiguousTimeError if there are ambiguous
          times.

    nonexistent : 'shift_forward', 'shift_backward', 'NaT', timedelta, default 'raise'
        A nonexistent time does not exist in a particular timezone
        where clocks moved forward due to DST.

        - 'shift_forward' will shift the nonexistent time forward to the
          closest existing time
        - 'shift_backward' will shift the nonexistent time backward to the
          closest existing time
        - 'NaT' will return NaT where there are nonexistent times
        - timedelta objects will shift nonexistent times by the timedelta
        - 'raise' will raise an NonExistentTimeError if there are
          nonexistent times.

    Returns
    -------
    DatetimeIndex, TimedeltaIndex, or Series
        Index of the same type for a DatetimeIndex or TimedeltaIndex,
        or a Series with the same index for a Series.

    Raises
    ------
    ValueError if the `freq` cannot be converted.

    Notes
    -----
    If the timestamps have a timezone, {op}ing will take place relative to the
    local ("wall") time and re-localized to the same timezone. When {op}ing
    near daylight savings time, use ``nonexistent`` and ``ambiguous`` to
    control the re-localization behavior.

    Examples
    --------
    **DatetimeIndex**

    >>> rng = pd.date_range('1/1/2018 11:59:00', periods=3, freq='min')
    >>> rng
    DatetimeIndex(['2018-01-01 11:59:00', '2018-01-01 12:00:00',
                   '2018-01-01 12:01:00'],
                  dtype='datetime64[ns]', freq='min')
    a  >>> rng.round('h')
    DatetimeIndex(['2018-01-01 12:00:00', '2018-01-01 12:00:00',
                   '2018-01-01 12:00:00'],
                  dtype='datetime64[ns]', freq=None)

    **Series**

    >>> pd.Series(rng).dt.round("h")
    0   2018-01-01 12:00:00
    1   2018-01-01 12:00:00
    2   2018-01-01 12:00:00
    dtype: datetime64[ns]

    When rounding near a daylight savings time transition, use ``ambiguous`` or
    ``nonexistent`` to control how the timestamp should be re-localized.

    >>> rng_tz = pd.DatetimeIndex(["2021-10-31 03:30:00"], tz="Europe/Amsterdam")

    >>> rng_tz.floor("2h", ambiguous=False)
    DatetimeIndex(['2021-10-31 02:00:00+01:00'],
                  dtype='datetime64[ns, Europe/Amsterdam]', freq=None)

    >>> rng_tz.floor("2h", ambiguous=True)
    DatetimeIndex(['2021-10-31 02:00:00+02:00'],
                  dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
    a  >>> rng.floor('h')
    DatetimeIndex(['2018-01-01 11:00:00', '2018-01-01 12:00:00',
                   '2018-01-01 12:00:00'],
                  dtype='datetime64[ns]', freq=None)

    **Series**

    >>> pd.Series(rng).dt.floor("h")
    0   2018-01-01 11:00:00
    1   2018-01-01 12:00:00
    2   2018-01-01 12:00:00
    dtype: datetime64[ns]

    When rounding near a daylight savings time transition, use ``ambiguous`` or
    ``nonexistent`` to control how the timestamp should be re-localized.

    >>> rng_tz = pd.DatetimeIndex(["2021-10-31 03:30:00"], tz="Europe/Amsterdam")

    >>> rng_tz.floor("2h", ambiguous=False)
    DatetimeIndex(['2021-10-31 02:00:00+01:00'],
                 dtype='datetime64[ns, Europe/Amsterdam]', freq=None)

    >>> rng_tz.floor("2h", ambiguous=True)
    DatetimeIndex(['2021-10-31 02:00:00+02:00'],
                  dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
    a  >>> rng.ceil('h')
    DatetimeIndex(['2018-01-01 12:00:00', '2018-01-01 12:00:00',
                   '2018-01-01 13:00:00'],
                  dtype='datetime64[ns]', freq=None)

    **Series**

    >>> pd.Series(rng).dt.ceil("h")
    0   2018-01-01 12:00:00
    1   2018-01-01 12:00:00
    2   2018-01-01 13:00:00
    dtype: datetime64[ns]

    When rounding near a daylight savings time transition, use ``ambiguous`` or
    ``nonexistent`` to control how the timestamp should be re-localized.

    >>> rng_tz = pd.DatetimeIndex(["2021-10-31 01:30:00"], tz="Europe/Amsterdam")

    >>> rng_tz.ceil("h", ambiguous=False)
    DatetimeIndex(['2021-10-31 02:00:00+01:00'],
                  dtype='datetime64[ns, Europe/Amsterdam]', freq=None)

    >>> rng_tz.ceil("h", ambiguous=True)
    DatetimeIndex(['2021-10-31 02:00:00+02:00'],
                  dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
    c                    ^  \ rS rSr% SrS\S'   S\R                  S4   S(S jjr\	S 5       r
\S	 5       r\R                  S)S
 j5       r\S*S j5       r\\	S+S j5       5       r\	    S,S j5       r\S-S j5       r\S.S j5       rS/S0S jjrS rS1U 4S jjrS r\" \\-   R9                  SS95        S2     S3S jj5       r\" \\-   R9                  SS95        S2     S3S jj5       r\" \\ -   R9                  SS95        S2     S3S jj5       r!SSS.S4S jjr"SSS.S4S jjr#S)S jr$S5S  jr%S6U 4S! jjr&  S7   S8U 4S" jjjr'\	 S9     S:U 4S# jjj5       r(S;S<U 4S$ jjjr)          S=S% jr*\S>S& j5       r+S'r,U =r-$ )?r  i  zC
Common ops for TimedeltaIndex/DatetimeIndex, but not PeriodIndex.
znp.dtype_default_dtypeNFc                   [         R                  " [        U 5      R                   S3[        [        5       S9  Ub  [        U5      n[        USS9n[        U[        5      (       a  UR                  S[        S9n[        USS 5      nUS L nU[        R                  La  UOS n[        U[        U 5      5      (       a  U(       a  OHUc  UR                  nO8U(       a1  UR                  (       a   [!        U5      n[#        X1R                  5      nUb*  X!R$                  :w  a  ['        SU S	UR$                   35      eUR$                  nUR(                  nOUc  [        U[*        R,                  5      (       a'  UR$                  R.                  S
;   a  UR$                  nOLU R0                  n[        U[*        R,                  5      (       a!  UR$                  S:X  a  UR3                  U5      n[        U[*        R,                  5      (       d8  [5        S[        U5      R                   S[        U 5      R                   S35      eUR6                  S;  a  [5        S5      eUR$                  S:X  a  Uc(  U R0                  nUR3                  U R0                  5      nO|[        R8                  " US5      (       a  UR3                  U5      nON[        U[:        5      (       a9  U R0                  R.                  nU SUR<                   S3nUR3                  U5      nU R?                  X5      nUS:X  a"  [5        S[        U 5      R                   S35      eU(       a  URA                  5       nU(       aE  [!        U5      nUR$                  R.                  S:X  a   [        U[B        5      (       d  ['        S5      e[D        RF                  " XUS9  X0l$        Uc  Ub  [        U 5      RK                  X5        g g g )NzV.__init__ is deprecated and will be removed in a future version. Use pd.array instead.rU  Tr2  r  na_valuer   dtype=z does not match data dtype Mmrx   zUnexpected type 'z'. 'values' must be a z6, ndarray, or Series or Index containing one of those.)r      z.Only 1-dimensional input arrays are supported.r  8[r  inferz#Frequency inference not allowed in z$.__init__. Use 'pd.array()' instead.r   (TimedeltaArray/Index freq must be a Tick)r   rz   )&r[  r\  r  r  r]  r?   rF   r`   ry   r]   rE  r   r   r   
no_defaultr   r"   _validate_inferred_freqrz   r  r   r   r  r  r  r{   r  r   r  rI   r5  _validate_dtyper   r   r   r   r   _validate_frequency)	r   r   rz   r   r   ru  explicit_noner  rj  s	            rr   r   TimelikeOps.__init__  sE    	Dz""# $A A')	
  'EvT:fl++__Wt_<F63>>1ttfd4j)){{&++ .t[[A Ull%:UG#>v||nM  LLE__F]&"**--&,,2C2Ct2K++fbjj11flld6J#[[/F&"**--#DL$9$9#::P:&&' (++ 
 ;;f$MNN<<4 }++T%8%89--U+E?33**//#fBuzzl!4	Y/$$V37?5d4j6I6I5J K, , 
 [[]FT?D||  C'
40F0F JKKt%@
 T%5J**46 &6 rt   c                    [        U 5      ero   r   )clsr   rz   s      rr   r  TimelikeOps._validate_dtype  s    !#&&rt   c                    U R                   $ )z;
Return the frequency object if it is set, otherwise None.
rm  r   s    rr   r   TimelikeOps.freq  s    
 zzrt   c                    Ubq  [        U5      nU R                  X5        U R                  R                  S:X  a   [	        U[
        5      (       d  [        S5      eU R                  S:  a  [        S5      eXl	        g )Nr   r  r   zCannot set freq with ndim > 1)
r"   r  rz   r  ry   r   r  r   r  r   r   s     rr   r   r    sd    e$E$$T1zz#%j.E.E JKKyy1} !@AA
rt   c                V   Uc  SU l         gUS:X  a)  U R                   c  [        U R                  5      U l         ggU[        R                  L a  gU R                   c.  [        U5      n[        U 5      R                  " X40 UD6  Xl         g[        U5      n[        XR                   5        g)z
Constructor helper to pin the appropriate `freq` attribute.  Assumes
that self._freq is currently set to any freq inferred in
_from_sequence_not_strict.
Nr  )r   r"   ru  r   r  r  r  r  )r   r   validate_kwdss      rr   _maybe_pin_freqTimelikeOps._maybe_pin_freq  s     <DJW_ zz! 't'9'9:
 " S^^# ZZ T?DJ**4GGJ T?D#D**5rt   c           	        UR                   nUR                  S:X  d  XBR                  :X  a  g U R                  " SUS   S[	        U5      UUR
                  S.UD6n[        R                  " UR                  UR                  5      (       d  [        eg! [         a2  nS[        U5      ;   a  Ue[        SU SUR                   35      UeSnAff = f)a%  
Validate that a frequency is compatible with the values of a given
Datetime Array/Index or Timedelta Array/Index

Parameters
----------
index : DatetimeIndex or TimedeltaIndex
    The index on which to determine if the given frequency is valid
freq : DateOffset
    The frequency to validate
r   N)startendperiodsr   r5  z	non-fixedInferred frequency 9 from passed values does not conform to passed frequency r   )ru  r  rq  _generate_ranger   r5  r   array_equalr   r  r  )r  indexr   r   r_  on_freqr!  s          rr   r  TimelikeOps._validate_frequency0  s     &&::?h,,6	)) AhE
ZZ G >>%**gll;;   < 	c#h& 	 %hZ 088<~G 	s   A$B 
C-C

Cc                    [        U 5      ero   r   )r  r  r  r  r   r   r   s          rr   r  TimelikeOps._generate_range\  s     "#&&rt   c                @    [        U R                  R                  5      $ ro   )r   r   rz   r   s    rr   r  TimelikeOps._cresod  s    "4==#6#677rt   c                ,    [        U R                  5      $ ro   )dtype_to_unitrz   r   s    rr   r5  TimelikeOps.unith  s    
 TZZ((rt   Tc                   US;  a  [        S5      e[        R                  " U R                  R                   SU S35      n[	        U R
                  X2S9n[        U R                  [        R                  5      (       a  UR                  nO[        SU 5      R                  n[        XaS9n[        U 5      R                  XEU R                  S9$ )	N)smsusnsz)Supported units are 's', 'ms', 'us', 'ns'r  r  r0  rk   r  r  )r  r   rz   r  r   r   ry   r   r   rI   r  r  r   )r   r5  r1  rz   r  rj  r   s          rr   r4  TimelikeOps.as_unito  s    ..HIIDJJOO,BtfA67(Q
djj"((++"((Iot,//B'29I Dz%%dii & 
 	
rt   c                    U R                   UR                   :w  aS  U R                   UR                   :  a  U R                  UR                  5      n X4$ UR                  U R                  5      nX4$ ro   )r  r4  r5  r   s     rr   r  "TimelikeOps._ensure_matching_resos  sZ    ;;%,,&{{U\\)||EJJ/ { dii0{rt   c                   > U[         R                  [         R                  [         R                  4;   a3  [	        U5      S:X  a$  US   U L a  [        X5      " U R                  40 UD6$ [        TU ]   " X/UQ70 UD6$ )Nr   r   )	r   isnanisinfisfiniter   r   r   r   __array_ufunc__)r   ufuncmethodinputsr   r   s        rr   r  TimelikeOps.__array_ufunc__  sk    bhh"++66Fq q	T! 5)$--B6BBw&uHvHHHrt   c                :   [        U R                  [        5      (       aI  [        SU 5      n U R	                  S 5      nUR                  XX45      nUR	                  U R                  X4S9$ U R                  S5      n[        [        R                  U5      n[        XR                  5      nUS:X  a  U R                  5       $ [        XrU5      n	U R                  U	[        S9nUR                  U R                   R                  5      nU R#                  X`R                  S9$ )Nrk   )	ambiguousnonexistentrx   r   rm  r   )ry   rz   rI   r   tz_localize_roundr   r{   r   r  r&   r  r   r$   rn  r   r   r  )
r   r   rN  r  r  naiver   r   nanos	result_i8s
             rr   r  TimelikeOps._round  s    djj/22.D$$T*E\\$iEF%%9 &   4bjj&)"45A:99;!&6	))))ET]]001jj99rt   round)rq   c                D    U R                  U[        R                  X#5      $ ro   )r  r#   NEAREST_HALF_EVENr   r   r  r  s       rr   r  TimelikeOps.round  s     {{4!:!:ISSrt   floorc                D    U R                  U[        R                  X#5      $ ro   )r  r#   MINUS_INFTYr  s       rr   r  TimelikeOps.floor  s     {{4!4!4iMMrt   ceilc                D    U R                  U[        R                  X#5      $ ro   )r  r#   
PLUS_INFTYr  s       rr   r  TimelikeOps.ceil  s     {{4!3!3YLLrt   r1  c               ^    [         R                  " U R                  XU R                  5       S9$ NrC  )rR   nananyr   rO   r   r2  rR  s      rr   rg  TimelikeOps.any  s    }}T]]499;WWrt   c               ^    [         R                  " U R                  XU R                  5       S9$ r  )rR   nanallr   rO   r  s      rr   r[  TimelikeOps.all  s!     }}T]]499;WWrt   c                    S U l         g ro   rm  r   s    rr   r   TimelikeOps._maybe_clear_freq  s	    
rt   c                2   Uc  O|[        U 5      S:X  aP  [        U[        5      (       a;  U R                  R                  S:X  a   [        U[
        5      (       d  [        S5      eOUS:X  d   e[        U R                  5      nU R                  5       nXl
        U$ )z
Helper to get a view on the same data, with a new freq.

Parameters
----------
freq : DateOffset, None, or "infer"

Returns
-------
Same type as self
r   r   r  r  )r   ry   r   rz   r  r   r  r"   ru  r{   r   )r   r   r   s      rr   
_with_freqTimelikeOps._with_freq  s     <Y!^
4 < <zz#%jt.D.D JKK 7?"?T//0Diik	
rt   c                   > [        U R                  [        R                  5      (       a  U R                  $ [        TU ]  5       $ ro   )ry   rz   r   r   r   _values_for_json)r   r   s    rr   r  TimelikeOps._values_for_json  s0    djj"((++== w'))rt   c                j  > U R                   bp  [        R                  " [        U 5      [        R                  S9nU R                  5       nU(       a*  U R                   R                  S:  a  US S S2   nUS S S2   nX44$ U(       a"  [        S[        U 5      R                   S35      e[        TU ]-  US9$ )Nr   r   zThe 'sort' keyword in zu.factorize is ignored unless arr.freq is not None. To factorize with sort, call pd.factorize(obj, sort=True) instead.)use_na_sentinel)r   r   aranger   intpr   r   NotImplementedErrorr  r  r   	factorize)r   r  sortcodesuniquesr   s        rr   r  TimelikeOps.factorize	  s    
 99 IIc$irww7EiikG		add!$B$->! &(d)<)<(= >= = 
 w  AArt   c                Z  >^ [         TU ]  X5      nUS   mUS:X  a  U Vs/ s H  n[        U5      (       d  M  UPM     nnTR                  bX  [	        U4S jU 5       5      (       a>  [        US S USS  5      n[	        U4S jU 5       5      (       a  TR                  nXcl        U$ s  snf )Nr   c              3  T   >#    U  H  oR                   TR                   :H  v   M     g 7fro   r   )r   r   r  s     rr   r   0TimelikeOps._concat_same_type.<locals>.<genexpr>*	  s     +R	1FFchh,>	s   %(r  r   c              3  ^   >#    U  H"  oS    S   TR                   -   US   S    :H  v   M$     g7f)r   r  r   Nr  )r   pairr  s     rr   r   r  ,	  s-     NAwr{SXX-a;s   *-)r   _concat_same_typer   r   r[  zipr   )	r  	to_concatr2  new_objr   pairsr  r  r   s	          @rr   r  TimelikeOps._concat_same_type	  s     '+I<l19 %.8IqQII8xx#+R	+R(R(RIcrNIabM:NNNN"xxH$,M 9s
   B(B(c                D   > [         TU ]  US9nU R                  Ul        U$ )N)order)r   r   r   r   )r   r  r  r   s      rr   r   TimelikeOps.copy1	  s#    ',U,+		rt   c          
        US:w  a  [         eU(       d  U R                  n	OU R                  R                  5       n	[        R                  " U	4UUUUUUS.UD6  U(       d  U $ [        U 5      R                  XR                  S9$ )z"
See NDFrame.interpolate.__doc__.
linear)r  r2  r  limitlimit_direction
limit_arear   )r  r   r   rQ   interpolate_2d_inplacer  r  rz   )
r   r  r2  r  r  r  r  r   r   out_datas
             rr   interpolateTimelikeOps.interpolate6	  s      X%%}}H}}))+H&&		
+!		
 		
 KDz%%hjj%AArt   c                   [         R                  " U R                  5      (       d  gU R                  nU[        :g  n[        U R                  5      n[        U5      n[        R                  " X!U-  S:g  5      R                  5       S:H  nU$ )z
Check if we are round times at midnight (and no timezone), which will
be given a more compact __repr__ than other cases. For TimedeltaArray
we are checking for multiples of 24H.
Fr   )
r   r  rz   r   r   r   r!   r   logical_andrU  )r   
values_intconsider_valuesr   ppd	even_dayss         rr   _is_dates_onlyTimelikeOps._is_dates_only_	  st     tzz**YY
$,"4::.d# NN?4D4IJNNPTUU	rt   rm  )r   rY  ro  rq  ru  )r  dict)r   r   )r  
int | Nonero  r3   )ro  r{  ry  rv  )r5  r  r1  rY  ro  r3   )r  znp.ufuncr  r  )raiser  )r  r5   r  r6   ro  r3   )r2  rz  rR  rY  ro  rY  rw  rs  )TF)r  rY  r  rY  )r   )r  zSequence[Self]r2  r)   ro  r3   )C)r  r  ro  r3   )
r  r.   r2  r{  r  rj   r   rY  ro  r3   rn  ).r  r|  r}  r~  r  r  r   r  r   classmethodr  r  r   setterr   r  r  r  r>   r  r5  r4  r  r  r  r<   
_round_doc_round_exampler   r  _floor_exampler  _ceil_exampler  rg  r[  r   r  r  r  r  r   r  r  r  r  r  s   @rr   r  r    s     !s~~EZ7=AZ7	Z7x ' '   
[[
 
 6 6@ (  (T '",'	' ' 8 8 ) )
*	I:, zN*22g2>? $+'.	T !T %	T
 
T @T zN*22g2>? $+'.	N !N %	N
 
N @N zM)11V1<= $+'.	M !M %	M
 
M >M -1 X -1 X@* !%BB B B0  !  
	 * 
$B #$B 	$B
 $B $B 
$BR  rt   r  c                ^   [        U S5      (       dN  [        U [        [        45      (       d%  [        R
                  " U 5      S:X  a  [        U 5      n [        U 5      n SnO.[        U [        5      (       a  [        SU S35      e[        U SS9n [        U [        5      (       d/  [        U [        5      (       a3  U R                  R                  S;   a  U R                  S	[        S
9n SnX4$ [        U [        5      (       a%  U R!                  5       n U R                  5       n SnX4$ [        U [        R"                  [$        45      (       d  [        R&                  " U 5      n X4$ [        U [(        5      (       a4  U R*                  R-                  U R.                  [0        S9R2                  n SnX4$ )Nrz   r   FzCannot create a z from a MultiIndex.Tr2  r  r  r  r  )r,  ry   r   tupler   r   r@   rM   r  r`   r]   r[   rz   r  rE  r   _maybe_convert_datelike_arrayr  r\   r  rL   r9  taker  r   _values)r   r   cls_names      rr   !ensure_arraylike_for_datetimeliker+  y	  sl    4!!$u..2774=A3E:D6t<	D-	(	(*8*4GHIIT6$%%4,--$**//T2I}}Wt}4  : 
D-	.	.113}} : rzz>:;;zz$ : 
D.	)	) ##DJJ3#?GG:rt   c                    g ro   r   r  s    rr   validate_periodsr.  	      rt   c                    g ro   r   r-  s    rr   r.  r.  	  r/  rt   c                    U bs  [         R                  " U 5      (       a/  [        R                  " S[        [        5       S9  [        U 5      n U $ [         R                  " U 5      (       d  [        SU  35      eU $ )a  
If a `periods` argument is passed to the Datetime/Timedelta Array/Index
constructor, cast it to an integer.

Parameters
----------
periods : None, float, int

Returns
-------
periods : None or int

Raises
------
TypeError
    if periods is None, float, or int
zNon-integer 'periods' in pd.date_range, pd.timedelta_range, pd.period_range, and pd.interval_range are deprecated and will raise in a future version.rU  zperiods must be a number, got )	r   is_floatr[  r\  r]  r?   r{  r  r  r-  s    rr   r.  r.  	  sp    $ <<  MM2 +- 'lG N ((<WIFGGNrt   c                \    Ub(  U b   X:w  a  [        SU SU R                   35      eU c  Un U $ )z
If the user passes a freq and another freq is inferred from passed data,
require that they match.

Parameters
----------
freq : DateOffset or None
inferred_freq : DateOffset or None

Returns
-------
freq : DateOffset or None
r  r  )r  rq  )r   ru  s     rr   r  r  	  sM        5%m_ 5?<<." 
 < DKrt   c                   [        U [        5      (       a  U R                  $ [        U [        5      (       a6  U R                  S;  a  [        SU < S35      eU R                  R                  $ [        R                  " U 5      S   $ )z
Return the unit str corresponding to the dtype's resolution.

Parameters
----------
dtype : DatetimeTZDtype or np.dtype
    If np.dtype, we assume it is a datetime64 dtype.

Returns
-------
str
r  r  z does not have a resolution.r   )	ry   rI   r5  rG   r  r  pyarrow_dtyper   datetime_datar   s    rr   r  r  	  sq     %))zz	E:	&	&::T!x'CDEE""'''E"1%%rt   )rp   r  )r   r-   ro  r-   )r   rY  r*  r  ro  ztuple[ArrayLike, bool])r  rq  ro  rq  )r  zint | floatro  r{  )r  zint | float | Nonero  r  )r   r   ru  r   ro  r   )rz   z'DatetimeTZDtype | np.dtype | ArrowDtypero  r  )
__future__r   r   r   	functoolsr   r  typingr   r   r	   r
   r   r   r   r   r[  numpyr   pandas._libsr   r   pandas._libs.arraysr   pandas._libs.tslibsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   pandas._libs.tslibs.fieldsr#   r$   pandas._libs.tslibs.np_datetimer%   pandas._libs.tslibs.timedeltasr&   pandas._libs.tslibs.timestampsr'   pandas._typingr(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   pandas.compat.numpyr8   r4  pandas.errorsr9   r:   r;   pandas.util._decoratorsr<   r=   r>   pandas.util._exceptionsr?   pandas.core.dtypes.castr@   pandas.core.dtypes.commonrA   rB   rC   rD   rE   rF   pandas.core.dtypes.dtypesrG   rH   rI   rJ   rK   pandas.core.dtypes.genericrL   rM   pandas.core.dtypes.missingrN   rO   pandas.corerP   rQ   rR   rS   pandas.core.algorithmsrT   rU   rV   pandas.core.array_algosrW   pandas.core.arraylikerX   pandas.core.arrays._mixinsrY   rZ   pandas.core.arrays.arrow.arrayr[   pandas.core.arrays.baser\   pandas.core.arrays.integerr]   pandas.core.commoncorecommonr   pandas.core.constructionr^   r8  r_   r`   pandas.core.indexersra   rb   pandas.core.ops.commonrc   pandas.core.ops.invalidrd   re   pandas.tseriesrf   collections.abcrg   rh   rD  rj   r  rk   rl   rm   rr  rs   r   r   r  r!  r"  r#  r$  r  r+  r.  r  r  r   rt   rr   <module>r]     s   "  	 	 	   .    & K = C    $ / 
 
 5 K  
  
 ? * ? 2 3     
 <
 '
   ('121
6B3)B3J071( 71t=
~668^( ^J$$ #$$N 
 
 
 
D
,=:&rt   