
    Pi                   8   d dl mZ d dlmZmZmZ d dlmZmZmZm	Z	m
Z
 d dlZd dlZd dlmZ d dlmZ d dlmZmZ d dlmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z( d d	l)m*Z* d d
l+m,Z, d dl-m.Z. d dl/m0Z0 d dl1m2Z2 d dl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9 d dl:m;Z;m<Z<m=Z= d dl>m?Z? d dl@mAZB d dlCmDZD d dlEmFc mGZH d dlImJZJ d dlKmLZLmMZM erFd dlNmOZOmPZPmQZQ d dlRmSZSmTZTmUZUmVZVmWZWmXZXmYZYmZZZ d dl[m\Z\m]Z] d dl@m^Z^  eded          Z_ eded          Z`dZae
d`dad#            Zbe
d`dbd&            Zb	 dcddd*Zbdedfd0Zc e.d1           G d2 d3eBjd        eBje                              Zfd4dd4d4d5dd6dgdAZgdhdDZh	 	 	 	 didjdIZidedkdJZjdldLZkdM Zl	 dmdndOZmdodSZndpdVZodqdYZpdrd_ZqdS )s    )annotations)datetime	timedeltatzinfo)TYPE_CHECKINGSelfTypeVarcastoverloadN)using_string_dtype)
get_option)libtslib)
BaseOffsetNaTNaTType
Resolution	Timestampastype_overflowsafefieldsget_resolutionget_supported_dtypeget_unit_from_dtypeints_to_pydatetimeis_date_array_normalizedis_supported_dtypeis_unitlessnormalize_i8_timestamps	timezones	to_offsettz_convert_from_utctzconversion)abbrev_to_npy_unit)PerformanceWarning)
set_module)find_stack_level)validate_inclusive)DT64NS_DTYPEINT64_DTYPEis_bool_dtypeis_float_dtypeis_string_dtypepandas_dtype)DatetimeTZDtypeExtensionDtypePeriodDtype)isna)datetimelike)generate_regular_range)get_period_alias)DayTick)Callable	GeneratorIterator)	ArrayLikeDateTimeErrorChoicesDtypeObjIntervalClosedTypeTimeAmbiguousTimeNonexistentTimeUnitnpt)	DataFrame	TimedeltaPeriodArray_TimestampNoneT1_TimestampNoneT2i'  .tzr   unitr@   returnr.   c                    d S N rH   rI   s     p/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/pandas/core/arrays/datetimes.pytz_to_dtyperP   m   s    FIc    Nonenp.dtype[np.datetime64]c                    d S rL   rM   rN   s     rO   rP   rP   q   s    LOCrQ   nstzinfo | None)np.dtype[np.datetime64] | DatetimeTZDtypec                X    | t          j        d| d          S t          | |          S )z
    Return a datetime64[ns] dtype appropriate for the given timezone.

    Parameters
    ----------
    tz : tzinfo or None
    unit : str, default "ns"

    Returns
    -------
    np.dtype or Datetime64TZDType
    NM8[]rN   )npdtyper.   rN   s     rO   rP   rP   u   s4     
zxd&&&"40000rQ   namestrfield	docstring
str | Nonec                H    fd}| |_         ||_        t          |          S )Nc                   |                                  }| j        v r                    d          rg| j        }d}|r1|j        }|                    d|                    d|                    }||j        }nd }t          j        |||| j	                  }nt          j
        || j	                  }|S t          j
        || j	                  }|                     |d d          }|S )N)startend   startingMonthmonthresofloat64)
fill_valueconvert)_local_timestamps	_bool_opsendswithfreqkwdsgetr]   r   get_start_end_field_cresoget_date_field_maybe_mask_results)selfvaluesrq   month_kwrr   	freq_nameresultr_   s          rO   fz_field_accessor.<locals>.f   s
   ''))DN"" ~~.// Py V9D#xx'89T9TUUH# $	II $I3E9hT[    .vu4;OOO M&vu4;GGG))&T9)UUrQ   )__name____doc__property)r]   r_   r`   r}   s    `  rO   _field_accessorr      s8        > AJAIA;;rQ   zpandas.arraysc            	          e Zd ZU dZdZeej        fZd Z	de
d<   dZedd	            Zedd            Zg dZde
d<   g dZde
d<   g dZde
d<   eez   ez   g dz   Zde
d<   g dZde
d<   dZde
d<   dZde
d<   ed             Zedefd fd#            Zedd$d%dd(            Zedd$ej        ej        d$d$d)d*dd0            Ze	 	 	 	 	 dd2d3dd=            Zdd>Zdd@Z ddBZ!ddDZ"eddE            Z#eddG            Z$e$j%        dH             Z$eddI            Z&eddJ            Z'eddL            Z(dd fdNZ)ddPZ*dd fdRZ+dSddTddXZ,ddYZ-dd\Z.dd^Z/dd_Z0e1j2        	 	 ddd`            Z3ddaZ4ddbZ5ddddZ6dddeZ7dddfZ8eddg            Z9eddh            Z:eddi            Z;ddkZ< e=dldmdn          Z> e=dodpdq          Z? e=drdsdt          Z@ e=dudvdw          ZA e=dxdydz          ZB e=d{d|d}          ZC e=d~dd          ZD e=dd2d          ZEdZF e=ddeF          ZGeGZHeGZI e=ddd          ZJeJZK e=ddd          ZL e=ddd          ZMeMZNdZO e=ddeOP                    d                    ZQ e=ddeOP                    d                    ZR e=ddd          ZS e=ddd          ZT e=ddd          ZU e=ddd          ZV e=ddd          ZWddZXdQd$ddʈ fdZY	 	 	 	 	 	 dddZZ xZ[S )DatetimeArraya  
    Pandas ExtensionArray for tz-naive or tz-aware datetime data.

    .. warning::

       DatetimeArray is currently experimental, and its API may change
       without warning. In particular, :attr:`DatetimeArray.dtype` is
       expected to change to always be an instance of an ``ExtensionDtype``
       subclass.

    Parameters
    ----------
    data : Series, Index, DatetimeArray, ndarray
        The datetime data.

        For DatetimeArray `values` (or a Series or Index boxing one),
        `dtype` and `freq` will be extracted from `values`.

    dtype : numpy.dtype or DatetimeTZDtype
        Note that the only NumPy dtype allowed is 'datetime64[ns]'.
    freq : str or Offset, optional
        The frequency.
    copy : bool, default False
        Whether to copy the underlying array of values.

    Attributes
    ----------
    None

    Methods
    -------
    None

    See Also
    --------
    DatetimeIndex : Immutable Index for datetime-like data.
    Series : One-dimensional labeled array capable of holding datetime-like data.
    Timestamp : Pandas replacement for python datetime.datetime object.
    to_datetime : Convert argument to datetime.
    period_range : Return a fixed frequency PeriodIndex.

    Examples
    --------
    >>> pd.arrays.DatetimeArray._from_sequence(
    ...     pd.DatetimeIndex(["2023-01-01", "2023-01-02"], freq="D")
    ... )
    <DatetimeArray>
    ['2023-01-01 00:00:00', '2023-01-02 00:00:00']
    Length: 2, dtype: datetime64[us]
    datetimearrayc                V    t          j        | d          pt          | t                    S NM)r   is_np_dtype
isinstancer.   )xs    rO   <lambda>zDatetimeArray.<lambda>   s/    	3B B B(	A	'	' rQ   zCallable[[DtypeObj], bool]_is_recognized_dtype)r   
datetime64daterJ   np.datetime64c                6    t          j        d| j                  S )Nr   )r[   r   rI   rx   s    rO   _internal_fill_valuez"DatetimeArray._internal_fill_value   s    }UDI...rQ   type[Timestamp]c                    t           S rL   )r   r   s    rO   _scalar_typezDatetimeArray._scalar_type   s    rQ   )is_month_startis_month_endis_quarter_startis_quarter_endis_year_startis_year_endis_leap_yearz	list[str]ro   )yearrh   dayhourminutesecondweekday	dayofweekday_of_week	dayofyearday_of_yearquarterdays_in_monthdaysinmonthmicrosecond
nanosecond
_field_ops)r   timetimetz
_other_ops)rI   rq   rH   _datetimelike_ops)	to_periodtz_localize
tz_convert	normalizestrftimeroundfloorceil
month_nameday_nameas_unit_datetimelike_methodsi  rW   _dtypeNBaseOffset | None_freqc                (   t          |          }t          |j                   t          |t          j                  r|j        |k    rt	          d          n9t          j        |j                  d         }||j        k    rt	          d          |S )Nz'Values resolution does not match dtype.r   )_validate_dt64_dtyper\   r   r[   
ValueErrordatetime_datarI   )clsry   r\   vunits       rO   _validate_dtypezDatetimeArray._validate_dtype-  s     %U++V\***eRX&& 	L|u$$ !JKKK % $V\2215E
"" !JKKKrQ   ry   npt.NDArray[np.datetime64]rq   r\   r   c                \   t          |t          j                  sJ |j        dk    sJ t          |t          j                  r||j        k    sJ t          |          rJ n|j        t          |j                  k    sJ t                      	                    ||          }||_
        |S r   )r   r[   ndarraykindr\   r   ru   r   super_simple_newr   )r   ry   rq   r\   r|   	__class__s        rO   r   zDatetimeArray._simple_new<  s     &"*-----zS    eRX&& 	EFL(((("5)))))) <#6v|#D#DDDDD$$VU33rQ   Fr\   copyr   boolc               2    |                      |||          S Nr   )_from_sequence_not_strict)r   scalarsr\   r   s       rO   _from_sequencezDatetimeArray._from_sequenceQ  s    ,,WE,MMMrQ   raise)r\   r   rH   rq   dayfirst	yearfirst	ambiguous'str | BaseOffset | lib.NoDefault | Noner   r   r   r>   c          	        |du }	|t           j        u rd}nt          j        |          }t	          |          }t          |||	          }d}
|t          j        |          }
t          j        ||d          \  }}d}t          |t                    r|j        }t          |||||||
          \  }}t          |||	           ||	rt          d          t          j        |j                  d         }t#          d|          }t%          ||          }|                     |||          }|
 |
|j        k    r|                    |
          }d	|i}|                    ||           |S )
z\
        A non-strict version of _from_sequence, called from DatetimeIndex.__new__.
        Nr   )cls_namer   rH   r   r   r   out_unitz^Passed data is timezone-aware, incompatible with 'tz=None'. Use obj.tz_localize(None) instead.r   r@   rq   r\   r   )r   
no_defaultr   maybe_get_tzr   _validate_tz_from_dtypedtldtype_to_unit!ensure_arraylike_for_datetimeliker   r   rq   _sequence_to_dt64r   r[   r   r\   r
   rP   r   rI   r   _maybe_pin_freq)r   datar\   r   rH   rq   r   r   r   explicit_tz_nonerI   inferred_freqsubarr	data_unit
data_dtyper|   validate_kwdss                    rO   r   z'DatetimeArray._from_sequence_not_strictU  s   & :BB'++B$U++$UB0@AA$U++D:$
 
 

d dM** 	& IM&
 
 

 	 r+;<<<>.>5  
 $V\2215	Y//	 Y//
m:NN 3 3
 ^^D))F$i0t]333rQ   bothrU   rI   periods
int | Noner   nonexistentr?   	inclusiver=   rI   r@   c
                  t          j        |          }|+t          d |||fD                       rt          d          t	          j        ||||          dk    rt          d          t          |          }|t          |          }|t          |          }|t          u s	|t          u rt          d          |
|
dvrt          d          nd}
||	                    |
d	
          }||	                    |
d	
          }t          |	          \  }}t          |||          \  }}t          |||          }|&t          |||||          }t          |||||          }|Ct          |t                    s<||j        |                    d           }||j        |                    d           }t          |t          t$          f          rt'          |||||
          }n>t)          |||||
          }t+          j        d |D             t*          j                  }||j        n|j        }|p|nt1          j        |          s(t5          |
          }t7          j        |||||          }||                    |||          }||                    |||          }nbt;          t<          |          }t+          j        d|j         |j         z
  |d          |j         z   }|j!        dk    r|"                    d          }||k    r|s|s
|dd         }nzt          |          j         }t          |          j         }|r|sN|s%tG          |          r|d         |k    r
|dd          }|s%tG          |          r|d         |k    r
|d d         }|$                    d|
 d          }tK          ||
          }| &                    |||          S )Nc              3     K   | ]}|d u V  	d S rL   rM   .0r   s     rO   	<genexpr>z0DatetimeArray._generate_range.<locals>.<genexpr>  s&      IIaT	IIIIIIrQ   z1Must provide freq argument if no data is supplied   zVOf the four parameters: start, end, periods, and freq, exactly three must be specifiedz$Neither `start` nor `end` can be NaT)smsusrU   z+'unit' must be one of 's', 'ms', 'us', 'ns'rU   Fround_okr   )rd   re   r   offsetrI   c                    g | ]	}|j         
S rM   )_valuer   s     rO   
<listcomp>z1DatetimeArray._generate_range.<locals>.<listcomp>  s    $;$;$;!QX$;$;$;rQ   r\   r   r   cresor   int64i8   zdatetime64[rZ   r   )'r   validate_periodsanyr   comcount_not_noner    r   r   r   r'   _maybe_normalize_endpoints_infer_tz_from_endpoints_maybe_localize_pointr   r6   rH   r   r5   r3   _generate_ranger[   arrayr  r   is_utcr#   r"   tz_localize_to_utcr
   intlinspacer  r\   astypelenviewrP   r   )r   rd   re   r   rq   rH   r   r   r   r   rI   left_inclusiveright_inclusivei8valuesxdrendpoint_tzr  start_i8end_i8dt64_valuesr\   s                        rO   r  zDatetimeArray._generate_range  s^    &w//<CIIGUC3HIIIII<PQQQeS'488A==<   e$$E?C..CC<<3#::CDDD222 !NOOO 3 DMM$M77E?++dU+33C*<Y*G*G'/sIFF
s%eS"55>)%r9kRRE'T2y+NNC
 dD)) 0$)=!--d33E?sv'9//$//C$s,, M1%gtRVWWW%S'$T   8$;$;s$;$;$;28LLL&+&7%((SVK~+"5 '++ 
 /t44E+> "+$/#     H $!--b)[IIE?//"iEEC 3((GAszEL8'QQQ,  ~%% $??400C<<! */ *#AbD> ''.Hs^^*F! - -% ,#h-- ,HQK8<S<S'|H& -3x== -Xb\V=S=S'}Hmm$9$$9$9$9::BT***{UCCCrQ   c                   t          || j                  s|t          urt          d          |                     |           |t          u rt          j        |j        | j                  S |	                    | j        d          j
        S )Nz'value' should be a Timestamp.Fr   )r   r   r   r   _check_compatible_withr[   r   r  rI   r   asm8rx   values     rO   _unbox_scalarzDatetimeArray._unbox_scalar  s~    %!233 	?S8H8H=>>>##E***C<<=ty999==U=;;@@rQ   Timestamp | NaTTypec                .    t          || j                  S )NrH   )r   rH   r&  s     rO   _scalar_from_stringz!DatetimeArray._scalar_from_string'  s    47++++rQ   rR   c                F    |t           u rd S |                     |           d S rL   )r   _assert_tzawareness_compat)rx   others     rO   r$  z$DatetimeArray._check_compatible_with*  s*    C<<F''.....rQ   r   c                r    |                     d          }t          j        || j        | j                  }|S )Nr  )rj   rH   )r  r   _from_value_and_resoru   rH   )rx   r   r'  tss       rO   	_box_funczDatetimeArray._box_func2  s1    t+EPPP	rQ   c                    | j         S )a%  
        The dtype for the DatetimeArray.

        .. warning::

           A future version of pandas will change dtype to never be a
           ``numpy.dtype``. Instead, :attr:`DatetimeArray.dtype` will
           always be an instance of an ``ExtensionDtype`` subclass.

        Returns
        -------
        numpy.dtype or DatetimeTZDtype
            If the values are tz-naive, then ``np.dtype('datetime64[ns]')``
            is returned.

            If the values are tz-aware, then the ``DatetimeTZDtype``
            is returned.
        )r   r   s    rO   r\   zDatetimeArray.dtype8  s    . {rQ   rV   c                .    t          | j        dd          S )a*  
        Return the timezone.

        Returns
        -------
        zoneinfo.ZoneInfo,, datetime.tzinfo, pytz.tzinfo.BaseTZInfo, dateutil.tz.tz.tzfile, or None
            Returns None when the array is tz-naive.

        See Also
        --------
        DatetimeIndex.tz_localize : Localize tz-naive DatetimeIndex to a
            given time zone, or remove timezone from a tz-aware DatetimeIndex.
        DatetimeIndex.tz_convert : Convert tz-aware DatetimeIndex from
            one time zone to another.

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

        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-02-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.tz
        datetime.timezone.utc

        For DatetimeIndex:

        >>> idx = pd.DatetimeIndex(
        ...     ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]
        ... )
        >>> idx.tz
        datetime.timezone.utc
        rH   N)getattrr\   r   s    rO   rH   zDatetimeArray.tzQ  s    N tz4...rQ   c                     t          d          )NzNCannot directly set timezone. Use tz_localize() or tz_convert() as appropriate)AttributeErrorr&  s     rO   rH   zDatetimeArray.tzz  s     -
 
 	
rQ   c                    | j         S )z(
        Alias for tz attribute
        r+  r   s    rO   r   zDatetimeArray.tzinfo  s    
 wrQ   c                D    t          | j        | j        | j                  S )zN
        Returns True if all of the dates are at midnight ("no time")
        ri   )r   asi8rH   ru   r   s    rO   is_normalizedzDatetimeArray.is_normalized  s    
 (	47MMMMrQ   r   c                D    t          | j        | j        | j                  S )Nri   )r   r;  rH   ru   r   s    rO   _resolution_objzDatetimeArray._resolution_obj  s    dit{CCCCrQ   
np.ndarrayc                j    || j         rt          }t                                          ||          S r   )rH   objectr   	__array__)rx   r\   r   r   s      rO   rB  zDatetimeArray.__array__  s0    =TW=Eww  u4 888rQ   r9   c              #  t  K   | j         dk    r+t          t          |                     D ]}| |         V  dS | j        }t          |           }t          }||z  dz   }t          |          D ]J}||z  }t          |dz   |z  |          }t          |||         | j        d| j                  }|E d{V  KdS )zt
        Return an iterator over the boxed values

        Yields
        ------
        tstamp : Timestamp
        r	  	timestamp)rH   boxrj   N)	ndimranger  r;  _ITER_CHUNKSIZEminr   rH   ru   )	rx   ir   length	chunksizechunksstart_iend_i	converteds	            rO   __iter__zDatetimeArray.__iter__  s       9q==3t99%%  1g  9DYYF'I	)Q.F6]] 	% 	%i-QUi/88.'w#	  	 %$$$$$$$$	% 	%rQ   Tc                X   t          |          }|| j        k    r|r|                                 S | S t          |t                    rt          |t
                    s#t                                          ||          S | j        t          d          t          j        |j                  }t          | j        ||          }t          |                               ||| j                  S | j        st#          j        |d          r^t'          |          sOt)          |          r@t          | j        |d          }t          |                               ||j                  S | j        $t#          j        |d          rt          d          | j        >t#          j        |d          r)|| j        k    rt'          |          rt          d          t          |t*                    r|                     |j        	          S t.          j                            | ||          S )
Nr   zCannot use .astype to convert from timezone-naive dtype to timezone-aware dtype. Use obj.tz_localize instead or series.dt.tz_localize insteadr\   rq   r   Tr  zCannot use .astype to convert from timezone-aware dtype to timezone-naive dtype. Use obj.tz_localize(None) or obj.tz_convert('UTC').tz_localize(None) instead.z]Casting to unit-less dtype 'datetime64' is not supported. Pass e.g. 'datetime64[ns]' instead.)rq   )r-   r\   r   r   r/   r.   r   r  rH   	TypeErrorr[   r^   r   _ndarraytyper   rq   r   r   r   r   r0   r   r   DatetimeLikeArrayMixin)rx   r\   r   np_dtype
res_valuesr   s        rO   r  zDatetimeArray.astype  s+   
 U##DJ #yy{{"K~.. 4	3e_55 Www~~e$~777  4   8EI..0tTTT
Dzz--jDI-VVV GOs++ &&  #5))  -T]EMMMJ::))*J<L)MMM W S_UC%@%@  C   GOs++ ##E"" $ 6  
 {++ 	3>>uz>222)00udCCCrQ   r   )na_repdate_formatr[  str | floatnpt.NDArray[np.object_]c               h    |	| j         rd}t          j        | j        | j        ||| j                  S )Nz%Y-%m-%d)rH   formatr[  rj   )_is_dates_onlyr   format_array_from_datetimer;  rH   ru   )rx   r[  r\  kwargss       rO   _format_native_typesz"DatetimeArray._format_native_types  sB     4#6$K/I$'+f4;
 
 
 	
rQ   c                    t          |dd           }t          |dd           }t          |t                    r|j        j        }|t
          u rd S | j        |t          d          d S |t          d          d S )Nr   r\   z;Cannot compare tz-naive and tz-aware datetime-like objects.z:Cannot compare tz-naive and tz-aware datetime-like objects)r6  r   r.   r\   rH   r   rU  )rx   r/  other_tzother_dtypes       rO   r.  z(DatetimeArray._assert_tzawareness_compat  s    5(D11eWd33k?33 	&{~HC<<DW_#Q   $# L   rQ   r   r   c                   t          |t                    rJ | j        |                     d           }n| }	 |                    |j                  }|j        j        dk    r|                    |j                  }t          |           
                    ||j                  }|j        r|                                }d |_        | j        |                    | j                  }n# t          $ r{ t          d          r(t          j        dt"          t%                                 |                     d          |z   }t          |                               || j                  }Y nw xY w|S )NrJ  r  performance_warningszCNon-vectorized DateOffset being applied to Series or DatetimeIndex.
stacklevelO)r   r6   rH   r   _apply_arrayrV  r\   r   r  rW  r   r   r   NotImplementedErrorr   warningswarnr$   r&   r  r   )rx   r   ry   rZ  r|   s        rO   _add_offsetzDatetimeArray._add_offset'  s}   fd+++++7%%d++FFF	5,,V_==J$++
 (__V\::
 $ZZ++Jj>N+OOF $))++#w"++DG44% # 		M 		M 		M011 %&/11	    S))F2J$ZZ..z.LLFFF		M( s   AC) )BE.-E.npt.NDArray[np.int64]c                    | j         t          j        | j                   r| j        S t	          | j        | j         | j                  S )z
        Convert to an i8 (unix-like nanosecond timestamp) representation
        while keeping the local timezone and not using UTC.
        This is used to calculate time-of-day information as if the timestamps
        were timezone-naive.
        Nri   )rH   r   r  r;  r!   ru   r   s    rO   rn   zDatetimeArray._local_timestampsP  s?     7?i.tw77?9"49dgDKHHHHrQ   c                   t          j        |          }| j        t          d          t	          || j                  }d}t          | j        t                    r| j        }| 	                    | j
        ||          S )aW	  
        Convert tz-aware Datetime Array/Index from one time zone to another.

        Parameters
        ----------
        tz : str, zoneinfo.ZoneInfo, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
            Time zone for time. Corresponding timestamps would be converted
            to this time zone of the Datetime Array/Index. A `tz` of None will
            convert to UTC and remove the timezone information.

        Returns
        -------
        Array or Index
            Datetme Array/Index with target `tz`.

        Raises
        ------
        TypeError
            If Datetime Array/Index is tz-naive.

        See Also
        --------
        DatetimeIndex.tz : A timezone that has a variable offset from UTC.
        DatetimeIndex.tz_localize : Localize tz-naive DatetimeIndex to a
            given time zone, or remove timezone from a tz-aware DatetimeIndex.

        Examples
        --------
        With the `tz` parameter, we can change the DatetimeIndex
        to other time zones:

        >>> dti = pd.date_range(
        ...     start="2014-08-01 09:00", freq="h", periods=3, tz="Europe/Berlin"
        ... )

        >>> dti
        DatetimeIndex(['2014-08-01 09:00:00+02:00',
                       '2014-08-01 10:00:00+02:00',
                       '2014-08-01 11:00:00+02:00'],
                      dtype='datetime64[us, Europe/Berlin]', freq='h')

        >>> dti.tz_convert("US/Central")
        DatetimeIndex(['2014-08-01 02:00:00-05:00',
                       '2014-08-01 03:00:00-05:00',
                       '2014-08-01 04:00:00-05:00'],
                      dtype='datetime64[us, US/Central]', freq='h')

        With the ``tz=None``, we can remove the timezone (after converting
        to UTC if necessary):

        >>> dti = pd.date_range(
        ...     start="2014-08-01 09:00", freq="h", periods=3, tz="Europe/Berlin"
        ... )

        >>> dti
        DatetimeIndex(['2014-08-01 09:00:00+02:00',
                       '2014-08-01 10:00:00+02:00',
                       '2014-08-01 11:00:00+02:00'],
                        dtype='datetime64[us, Europe/Berlin]', freq='h')

        >>> dti.tz_convert(None)
        DatetimeIndex(['2014-08-01 07:00:00',
                       '2014-08-01 08:00:00',
                       '2014-08-01 09:00:00'],
                        dtype='datetime64[us]', freq='h')
        Nz?Cannot convert tz-naive timestamps, use tz_localize to localizer   rT  )r   r   rH   rU  rP   rI   r   rq   r6   r   rV  )rx   rH   r\   new_freqs       rO   r   zDatetimeArray.tz_convert\  s    F #B''7?Q  
 BTY///di&& 	!yHUJJJrQ   c                |   d}||vr$t          |t                    st          d          | j        3|"t	          | j        | j        | j                  }nFt          d          t          j	        |          }t          j        | j        |||| j                  }|                    d| j         d          }t          || j        	          }d}t          j        |          s(t!          |           d
k    rt#          |d                   s| j        }n|| j        | j        }|                     |||          S )a  
        Localize tz-naive Datetime Array/Index to tz-aware Datetime Array/Index.

        This method takes a time zone (tz) naive Datetime Array/Index object
        and makes this time zone aware. It does not move the time to another
        time zone.

        This method can also be used to do the inverse -- to create a time
        zone unaware object from an aware object. To that end, pass `tz=None`.

        Parameters
        ----------
        tz : str, zoneinfo.ZoneInfo,, pytz.timezone, dateutil.tz.tzfile, datetime.tzinfo or None
            Time zone to convert timestamps to. Passing ``None`` will
            remove the time zone information preserving local time.
        ambiguous : 'infer', 'NaT', bool array, default 'raise'
            When clocks moved backward due to DST, ambiguous times may arise.
            For example in Central European Time (UTC+01), when going from
            03:00 DST to 02:00 non-DST, 02:30:00 local time occurs both at
            00:30:00 UTC and at 01:30:00 UTC. In such a situation, the
            `ambiguous` parameter dictates how ambiguous times should be
            handled.

            - 'infer' will attempt to infer fall dst-transition hours based on
              order
            - bool-ndarray where True signifies a DST time, False signifies 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 a ValueError 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 a ValueError if there are
              nonexistent times.

        Returns
        -------
        Same type as self
            Array/Index converted to the specified time zone.

        Raises
        ------
        TypeError
            If the Datetime Array/Index is tz-aware and tz is not None.

        See Also
        --------
        DatetimeIndex.tz_convert : Convert tz-aware DatetimeIndex from
            one time zone to another.

        Examples
        --------
        >>> tz_naive = pd.date_range('2018-03-01 09:00', periods=3)
        >>> tz_naive
        DatetimeIndex(['2018-03-01 09:00:00', '2018-03-02 09:00:00',
                       '2018-03-03 09:00:00'],
                      dtype='datetime64[us]', freq='D')

        Localize DatetimeIndex in US/Eastern time zone:

        >>> tz_aware = tz_naive.tz_localize(tz='US/Eastern')
        >>> tz_aware
        DatetimeIndex(['2018-03-01 09:00:00-05:00',
                       '2018-03-02 09:00:00-05:00',
                       '2018-03-03 09:00:00-05:00'],
                      dtype='datetime64[us, US/Eastern]', freq=None)

        With the ``tz=None``, we can remove the time zone information
        while keeping the local time (not converted to UTC):

        >>> tz_aware.tz_localize(None)
        DatetimeIndex(['2018-03-01 09:00:00', '2018-03-02 09:00:00',
                       '2018-03-03 09:00:00'],
                      dtype='datetime64[us]', freq=None)

        Be careful with DST changes. When there is sequential data, pandas can
        infer the DST time:

        >>> s = pd.to_datetime(pd.Series(['2018-10-28 01:30:00',
        ...                               '2018-10-28 02:00:00',
        ...                               '2018-10-28 02:30:00',
        ...                               '2018-10-28 02:00:00',
        ...                               '2018-10-28 02:30:00',
        ...                               '2018-10-28 03:00:00',
        ...                               '2018-10-28 03:30:00']))
        >>> s.dt.tz_localize('CET', ambiguous='infer')
        0   2018-10-28 01:30:00+02:00
        1   2018-10-28 02:00:00+02:00
        2   2018-10-28 02:30:00+02:00
        3   2018-10-28 02:00:00+01:00
        4   2018-10-28 02:30:00+01:00
        5   2018-10-28 03:00:00+01:00
        6   2018-10-28 03:30:00+01:00
        dtype: datetime64[us, CET]

        In some cases, inferring the DST is impossible. In such cases, you can
        pass an ndarray to the ambiguous parameter to set the DST explicitly

        >>> s = pd.to_datetime(pd.Series(['2018-10-28 01:20:00',
        ...                               '2018-10-28 02:36:00',
        ...                               '2018-10-28 03:46:00']))
        >>> s.dt.tz_localize('CET', ambiguous=np.array([True, True, False]))
        0   2018-10-28 01:20:00+02:00
        1   2018-10-28 02:36:00+02:00
        2   2018-10-28 03:46:00+01:00
        dtype: datetime64[us, CET]

        If the DST transition causes nonexistent times, you can shift these
        dates forward or backwards with a timedelta object or `'shift_forward'`
        or `'shift_backwards'`.

        >>> s = pd.to_datetime(pd.Series(['2015-03-29 02:30:00',
        ...                               '2015-03-29 03:30:00'], dtype="M8[ns]"))
        >>> s.dt.tz_localize('Europe/Warsaw', nonexistent='shift_forward')
        0   2015-03-29 03:00:00+02:00
        1   2015-03-29 03:30:00+02:00
        dtype: datetime64[ns, Europe/Warsaw]

        >>> s.dt.tz_localize('Europe/Warsaw', nonexistent='shift_backward')
        0   2015-03-29 01:59:59.999999999+01:00
        1   2015-03-29 03:30:00+02:00
        dtype: datetime64[ns, Europe/Warsaw]

        >>> s.dt.tz_localize('Europe/Warsaw', nonexistent=pd.Timedelta('1h'))
        0   2015-03-29 03:30:00+02:00
        1   2015-03-29 03:30:00+02:00
        dtype: datetime64[ns, Europe/Warsaw]
        )r   r   shift_forwardshift_backwardzoThe nonexistent argument must be one of 'raise', 'NaT', 'shift_forward', 'shift_backward' or a timedelta objectNri   z,Already tz-aware, use tz_convert to convert.r  rY   rZ   r   r	  r   rT  )r   r   r   rH   r!   r;  ru   rU  r   r   r"   r  r  rI   rP   r  r  r1   rq   r   )	rx   rH   r   r   nonexistent_options	new_datesnew_dates_dt64r\   rq   s	            rO   r   zDatetimeArray.tz_localize  s_   d R111*;
 ;
1 %   7z/	47UUU		 NOOO'++B %7	#'k  I #(:di(:(:(:;;BTY///B 	CIINN4q@Q;R;RN 9DDZDGO9De$GGGrQ   c                D    t          | j        | j        | j                  S )ap  
        Return an ndarray of ``datetime.datetime`` objects.

        Returns
        -------
        numpy.ndarray
            An ndarray of ``datetime.datetime`` objects.

        See Also
        --------
        DatetimeIndex.to_julian_date : Converts Datetime Array to float64 ndarray
            of Julian Dates.

        Examples
        --------
        >>> idx = pd.date_range("2018-02-27", periods=3)
        >>> idx.to_pydatetime()
        array([datetime.datetime(2018, 2, 27, 0, 0),
               datetime.datetime(2018, 2, 28, 0, 0),
               datetime.datetime(2018, 3, 1, 0, 0)], dtype=object)
        )rH   rj   r   r;  rH   ru   r   s    rO   to_pydatetimezDatetimeArray.to_pydatetimej  s    , "$)dkJJJJrQ   c                D   t          | j        | j        | j                  }|                    | j        j                  }t          |                               ||j                  }|	                    d          }| j        |
                    | j                  }|S )a  
        Convert times to midnight.

        The time component of the date-time is converted to midnight i.e.
        00:00:00. This is useful in cases, when the time does not matter.
        Length is unaltered. The timezones are unaffected.

        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on Datetime Array/Index.

        Returns
        -------
        DatetimeArray, DatetimeIndex or Series
            The same type as the original data. Series will have the same
            name and index. DatetimeIndex will have the same name.

        See Also
        --------
        floor : Floor the datetimes to the specified freq.
        ceil : Ceil the datetimes to the specified freq.
        round : Round the datetimes to the specified freq.

        Examples
        --------
        >>> idx = pd.date_range(
        ...     start="2014-08-01 10:00", freq="h", periods=3, tz="Asia/Calcutta"
        ... )
        >>> idx
        DatetimeIndex(['2014-08-01 10:00:00+05:30',
                       '2014-08-01 11:00:00+05:30',
                       '2014-08-01 12:00:00+05:30'],
                        dtype='datetime64[us, Asia/Calcutta]', freq='h')
        >>> idx.normalize()
        DatetimeIndex(['2014-08-01 00:00:00+05:30',
                       '2014-08-01 00:00:00+05:30',
                       '2014-08-01 00:00:00+05:30'],
                       dtype='datetime64[us, Asia/Calcutta]', freq=None)
        ri   r  infer)r   r;  rH   ru   r  rV  r\   rW  r   
_with_freqr   )rx   
new_valuesr"  dtas       rO   r   zDatetimeArray.normalize  s    N -TYdkRRR
 oodm&9::4jj$$[8I$JJnnW%%7//$'**C
rQ   rE   c                   ddl m} | j        (t          j        dt
          t                                 ||| j        p| j        }t          | j
        t                    r.t          | j
        d          rt          | j
                  j        }|t          d          t!          |          }||}|} |j        | j        || j                  S )	a  
        Cast to PeriodArray/PeriodIndex at a particular frequency.

        Converts DatetimeArray/Index to PeriodArray/PeriodIndex.

        Parameters
        ----------
        freq : str or Period, optional
            One of pandas' :ref:`period aliases <timeseries.period_aliases>`
            or a Period object. Will be inferred by default.

        Returns
        -------
        PeriodArray/PeriodIndex
            Immutable ndarray holding ordinal values at a particular frequency.

        Raises
        ------
        ValueError
            When converting a DatetimeArray/Index with non-regular values,
            so that a frequency cannot be inferred.

        See Also
        --------
        PeriodIndex: Immutable ndarray holding ordinal values.
        DatetimeIndex.to_pydatetime: Return DatetimeIndex as object.

        Examples
        --------
        >>> df = pd.DataFrame(
        ...     {"y": [1, 2, 3]},
        ...     index=pd.to_datetime(
        ...         [
        ...             "2000-03-31 00:00:00",
        ...             "2000-05-31 00:00:00",
        ...             "2000-08-31 00:00:00",
        ...         ]
        ...     ),
        ... )
        >>> df.index.to_period("M")
        PeriodIndex(['2000-03', '2000-05', '2000-08'],
                    dtype='period[M]')

        Infer the daily frequency

        >>> idx = pd.date_range("2017-01-01", periods=2)
        >>> idx.to_period()
        PeriodIndex(['2017-01-01', '2017-01-02'],
                    dtype='period[D]')
        r   rD   NzNConverting to PeriodArray/Index representation will drop timezone information.rj  _period_dtype_codez8You must pass a freq argument as current index has none.r+  )pandas.core.arraysrE   rH   ro  rp  UserWarningr&   freqstrr   r   rq   r   hasattrr0   _freqstrr   r4   _from_datetime64rV  )rx   rq   rE   ress       rO   r   zDatetimeArray.to_period  s    f 	3222227M2+--	    <<54#5D$)Z00 7W	/6 6 7 #49--6| N   #4((C {D+{+DM4DGLLLLrQ   c                   |                                  }t          j        |d|| j                  }|                     |d          }t                      r)ddlm}m}  || |t          j
                            S |S )	u  
        Return the month names with specified locale.

        Parameters
        ----------
        locale : str, optional
            Locale determining the language in which to return the month name.
            Default is English locale (``'en_US.utf8'``). Use the command
            ``locale -a`` on your terminal on Unix systems to find your locale
            language code.

        Returns
        -------
        Series or Index
            Series or Index of month names.

        See Also
        --------
        DatetimeIndex.day_name : Return the day names with specified locale.

        Examples
        --------
        >>> s = pd.Series(pd.date_range(start="2018-01", freq="ME", periods=3))
        >>> s
        0   2018-01-31
        1   2018-02-28
        2   2018-03-31
        dtype: datetime64[us]
        >>> s.dt.month_name()
        0     January
        1    February
        2       March
        dtype: str

        >>> idx = pd.date_range(start="2018-01", freq="ME", periods=3)
        >>> idx
        DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
                      dtype='datetime64[us]', freq='ME')
        >>> idx.month_name()
        Index(['January', 'February', 'March'], dtype='str')

        Using the ``locale`` parameter you can set a different locale language,
        for example: ``idx.month_name(locale='pt_BR.utf8')`` will return month
        names in Brazilian Portuguese language.

        >>> idx = pd.date_range(start="2018-01", freq="ME", periods=3)
        >>> idx
        DatetimeIndex(['2018-01-31', '2018-02-28', '2018-03-31'],
                      dtype='datetime64[us]', freq='ME')
        >>> idx.month_name(locale="pt_BR.utf8")  # doctest: +SKIP
        Index(['Janeiro', 'Fevereiro', 'Março'], dtype='str')
        r   localerj   Nrl   r   StringDtyper  na_valuer  rn   r   get_date_name_fieldru   rw   r   pandasr  r  r[   nanrx   r  ry   r|   r  pd_arrays         rO   r   zDatetimeArray.month_name  s    j ''))+Ldk
 
 
 ))&T)BB 	H       
 8F++rv*F*F*FGGGGrQ   c                   |                                  }t          j        |d|| j                  }|                     |d          }t                      r)ddlm}m}  || |t          j
                            S |S )	u  
        Return the day names with specified locale.

        Parameters
        ----------
        locale : str, optional
            Locale determining the language in which to return the day name.
            Default is English locale (``'en_US.utf8'``). Use the command
            ``locale -a`` on your terminal on Unix systems to find your locale
            language code.

        Returns
        -------
        Series or Index
            Series or Index of day names.

        See Also
        --------
        DatetimeIndex.month_name : Return the month names with specified locale.

        Examples
        --------
        >>> s = pd.Series(pd.date_range(start="2018-01-01", freq="D", periods=3))
        >>> s
        0   2018-01-01
        1   2018-01-02
        2   2018-01-03
        dtype: datetime64[us]
        >>> s.dt.day_name()
        0       Monday
        1      Tuesday
        2    Wednesday
        dtype: str

        >>> idx = pd.date_range(start="2018-01-01", freq="D", periods=3)
        >>> idx
        DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'],
                      dtype='datetime64[us]', freq='D')
        >>> idx.day_name()
        Index(['Monday', 'Tuesday', 'Wednesday'], dtype='str')

        Using the ``locale`` parameter you can set a different locale language,
        for example: ``idx.day_name(locale='pt_BR.utf8')`` will return day
        names in Brazilian Portuguese language.

        >>> idx = pd.date_range(start="2018-01-01", freq="D", periods=3)
        >>> idx
        DatetimeIndex(['2018-01-01', '2018-01-02', '2018-01-03'],
                      dtype='datetime64[us]', freq='D')
        >>> idx.day_name(locale="pt_BR.utf8")  # doctest: +SKIP
        Index(['Segunda', 'Terça', 'Quarta'], dtype='str')
        r   r  Nr  r   r  r  r  r  r  s         rO   r   zDatetimeArray.day_nameK  s    j ''))+JvDK
 
 
 ))&T)BB 	H       
 8F++rv*F*F*FGGGGrQ   c                X    |                                  }t          |d| j                  S )a[  
        Returns numpy array of :class:`datetime.time` objects.

        The time part of the Timestamps.

        See Also
        --------
        DatetimeIndex.timetz : Returns numpy array of :class:`datetime.time`
            objects with timezones. The time part of the Timestamps.
        DatetimeIndex.date : Returns numpy array of python :class:`datetime.date`
            objects. Namely, the date part of Timestamps without time and timezone
            information.

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

        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-02-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.time
        0    10:00:00
        1    11:00:00
        dtype: object

        For DatetimeIndex:

        >>> idx = pd.DatetimeIndex(
        ...     ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]
        ... )
        >>> idx.time
        array([datetime.time(10, 0), datetime.time(11, 0)], dtype=object)
        r   rE  rj   rn   r   ru   rx   
timestampss     rO   r   zDatetimeArray.time  s-    R ++--
!*&t{KKKKrQ   c                F    t          | j        | j        d| j                  S )a  
        Returns numpy array of :class:`datetime.time` objects with timezones.

        The time part of the Timestamps.

        See Also
        --------
        DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects.
            The time part of the Timestamps.
        DatetimeIndex.tz : Return the timezone.

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

        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-02-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.timetz
        0    10:00:00+00:00
        1    11:00:00+00:00
        dtype: object

        For DatetimeIndex:

        >>> idx = pd.DatetimeIndex(
        ...     ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]
        ... )
        >>> idx.timetz
        array([datetime.time(10, 0, tzinfo=datetime.timezone.utc),
        datetime.time(11, 0, tzinfo=datetime.timezone.utc)], dtype=object)
        r   r  r}  r   s    rO   r   zDatetimeArray.timetz  s"    J "$)TW&t{SSSSrQ   c                X    |                                  }t          |d| j                  S )a  
        Returns numpy array of python :class:`datetime.date` objects.

        Namely, the date part of Timestamps without time and
        timezone information.

        See Also
        --------
        DatetimeIndex.time : Returns numpy array of :class:`datetime.time` objects.
            The time part of the Timestamps.
        DatetimeIndex.year : The year of the datetime.
        DatetimeIndex.month : The month as January=1, December=12.
        DatetimeIndex.day : The day of the datetime.

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

        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-02-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.date
        0    2020-01-01
        1    2020-02-01
        dtype: object

        For DatetimeIndex:

        >>> idx = pd.DatetimeIndex(
        ...     ["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"]
        ... )
        >>> idx.date
        array([datetime.date(2020, 1, 1), datetime.date(2020, 2, 1)], dtype=object)
        r   r  r  r  s     rO   r   zDatetimeArray.date  s-    T ++--
!*&t{KKKKrQ   rB   c                    ddl m} |                                 }t          j        || j                  } ||g dd          }| j        rd|j        | j        <   |S )a  
        Calculate year, week, and day according to the ISO 8601 standard.

        Returns
        -------
        DataFrame
            With columns year, week and day.

        See Also
        --------
        Timestamp.isocalendar : Function return a 3-tuple containing ISO year,
            week number, and weekday for the given Timestamp object.
        datetime.date.isocalendar : Return a named tuple object with
            three components: year, week and weekday.

        Examples
        --------
        >>> idx = pd.date_range(start="2019-12-29", freq="D", periods=4)
        >>> idx.isocalendar()
                    year  week  day
        2019-12-29  2019    52    7
        2019-12-30  2020     1    1
        2019-12-31  2020     1    2
        2020-01-01  2020     1    3
        >>> idx.isocalendar().week
        2019-12-29    52
        2019-12-30     1
        2019-12-31     1
        2020-01-01     1
        Freq: D, Name: week, dtype: UInt32
        r   )rB   ri   )r   weekr   UInt32)columnsr\   N)	r  rB   rn   r   build_isocalendar_sarrayru   _hasnailoc_isnan)rx   rB   ry   sarrayiso_calendar_dfs        rO   isocalendarzDatetimeArray.isocalendar  s    @ 	%$$$$$''))0dkJJJ#)3338
 
 
 ; 	504O -rQ   r   YaN  
        The year of the datetime.

        See Also
        --------
        DatetimeIndex.month: The month as January=1, December=12.
        DatetimeIndex.day: The day of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="YE")
        ... )
        >>> datetime_series
        0   2000-12-31
        1   2001-12-31
        2   2002-12-31
        dtype: datetime64[us]
        >>> datetime_series.dt.year
        0    2000
        1    2001
        2    2002
        dtype: int32
        rh   r   aE  
        The month as January=1, December=12.

        See Also
        --------
        DatetimeIndex.year: The year of the datetime.
        DatetimeIndex.day: The day of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="ME")
        ... )
        >>> datetime_series
        0   2000-01-31
        1   2000-02-29
        2   2000-03-31
        dtype: datetime64[us]
        >>> datetime_series.dt.month
        0    1
        1    2
        2    3
        dtype: int32
        r   Da{  
        The day of the datetime.

        See Also
        --------
        DatetimeIndex.year: The year of the datetime.
        DatetimeIndex.month: The month as January=1, December=12.
        DatetimeIndex.hour: The hours of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="D")
        ... )
        >>> datetime_series
        0   2000-01-01
        1   2000-01-02
        2   2000-01-03
        dtype: datetime64[us]
        >>> datetime_series.dt.day
        0    1
        1    2
        2    3
        dtype: int32
        r   ha  
        The hours of the datetime.

        See Also
        --------
        DatetimeIndex.day: The day of the datetime.
        DatetimeIndex.minute: The minutes of the datetime.
        DatetimeIndex.second: The seconds of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="h")
        ... )
        >>> datetime_series
        0   2000-01-01 00:00:00
        1   2000-01-01 01:00:00
        2   2000-01-01 02:00:00
        dtype: datetime64[us]
        >>> datetime_series.dt.hour
        0    0
        1    1
        2    2
        dtype: int32
        r   mab  
        The minutes of the datetime.

        See Also
        --------
        DatetimeIndex.hour: The hours of the datetime.
        DatetimeIndex.second: The seconds of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="min")
        ... )
        >>> datetime_series
        0   2000-01-01 00:00:00
        1   2000-01-01 00:01:00
        2   2000-01-01 00:02:00
        dtype: datetime64[us]
        >>> datetime_series.dt.minute
        0    0
        1    1
        2    2
        dtype: int32
        r   r   a  
        The seconds of the datetime.

        See Also
        --------
        DatetimeIndex.minute: The minutes of the datetime.
        DatetimeIndex.microsecond: The microseconds of the datetime.
        DatetimeIndex.nanosecond: The nanoseconds of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="s")
        ... )
        >>> datetime_series
        0   2000-01-01 00:00:00
        1   2000-01-01 00:00:01
        2   2000-01-01 00:00:02
        dtype: datetime64[us]
        >>> datetime_series.dt.second
        0    0
        1    1
        2    2
        dtype: int32
        r   r   a  
        The microseconds of the datetime.

        See Also
        --------
        DatetimeIndex.second: The seconds of the datetime.
        DatetimeIndex.nanosecond: The nanoseconds of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="us")
        ... )
        >>> datetime_series
        0   2000-01-01 00:00:00.000000
        1   2000-01-01 00:00:00.000001
        2   2000-01-01 00:00:00.000002
        dtype: datetime64[us]
        >>> datetime_series.dt.microsecond
        0       0
        1       1
        2       2
        dtype: int32
        r   a  
        The nanoseconds of the datetime.

        See Also
        --------
        DatetimeIndex.second: The seconds of the datetime.
        DatetimeIndex.microsecond: The microseconds of the datetime.

        Examples
        --------
        >>> datetime_series = pd.Series(
        ...     pd.date_range("2000-01-01", periods=3, freq="ns")
        ... )
        >>> datetime_series
        0   2000-01-01 00:00:00.000000000
        1   2000-01-01 00:00:00.000000001
        2   2000-01-01 00:00:00.000000002
        dtype: datetime64[ns]
        >>> datetime_series.dt.nanosecond
        0       0
        1       1
        2       2
        dtype: int32
        a  
    The day of the week with Monday=0, Sunday=6.

    Return the day of the week. It is assumed the week starts on
    Monday, which is denoted by 0 and ends on Sunday which is denoted
    by 6. This method is available on both Series with datetime
    values (using the `dt` accessor) or DatetimeIndex.

    Returns
    -------
    Series or Index
        Containing integers indicating the day number.

    See Also
    --------
    Series.dt.dayofweek : Alias.
    Series.dt.weekday : Alias.
    Series.dt.day_name : Returns the name of the day of the week.

    Examples
    --------
    >>> s = pd.date_range('2016-12-31', '2017-01-08', freq='D').to_series()
    >>> s.dt.dayofweek
    2016-12-31    5
    2017-01-01    6
    2017-01-02    0
    2017-01-03    1
    2017-01-04    2
    2017-01-05    3
    2017-01-06    4
    2017-01-07    5
    2017-01-08    6
    Freq: D, dtype: int32
    r   dowr   doya(  
        The ordinal day of the year.

        See Also
        --------
        DatetimeIndex.dayofweek : The day of the week with Monday=0, Sunday=6.
        DatetimeIndex.day : The day of the datetime.

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

        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-02-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.dayofyear
        0    1
        1   32
        dtype: int32

        For DatetimeIndex:

        >>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00",
        ...                         "2/1/2020 11:00:00+00:00"])
        >>> idx.dayofyear
        Index([1, 32], dtype='int32')
        r   qaa  
        The quarter of the date.

        See Also
        --------
        DatetimeIndex.snap : Snap time stamps to nearest occurring frequency.
        DatetimeIndex.time : Returns numpy array of datetime.time objects.
            The time part of the Timestamps.

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

        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "4/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-04-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.quarter
        0    1
        1    2
        dtype: int32

        For DatetimeIndex:

        >>> idx = pd.DatetimeIndex(["1/1/2020 10:00:00+00:00",
        ...                         "2/1/2020 11:00:00+00:00"])
        >>> idx.quarter
        Index([1, 1], dtype='int32')
        r   dima&  
        The number of days in the month.

        See Also
        --------
        Series.dt.day : Return the day of the month.
        Series.dt.is_month_end : Return a boolean indicating if the
            date is the last day of the month.
        Series.dt.is_month_start : Return a boolean indicating if the
            date is the first day of the month.
        Series.dt.month : Return the month as January=1 through December=12.

        Examples
        --------
        >>> s = pd.Series(["1/1/2020 10:00:00+00:00", "2/1/2020 11:00:00+00:00"])
        >>> s = pd.to_datetime(s)
        >>> s
        0   2020-01-01 10:00:00+00:00
        1   2020-02-01 11:00:00+00:00
        dtype: datetime64[us, UTC]
        >>> s.dt.daysinmonth
        0    31
        1    29
        dtype: int32
        a  
        Indicates whether the date is the {first_or_last} day of the month.

        Returns
        -------
        Series or array
            For Series, returns a Series with boolean values.
            For DatetimeIndex, returns a boolean array.

        See Also
        --------
        is_month_start : Return a boolean indicating whether the date
            is the first day of the month.
        is_month_end : Return a boolean indicating whether the date
            is the last day of the month.

        Examples
        --------
        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on DatetimeIndex.

        >>> s = pd.Series(pd.date_range("2018-02-27", periods=3))
        >>> s
        0   2018-02-27
        1   2018-02-28
        2   2018-03-01
        dtype: datetime64[us]
        >>> s.dt.is_month_start
        0    False
        1    False
        2    True
        dtype: bool
        >>> s.dt.is_month_end
        0    False
        1    True
        2    False
        dtype: bool

        >>> idx = pd.date_range("2018-02-27", periods=3)
        >>> idx.is_month_start
        array([False, False, True])
        >>> idx.is_month_end
        array([False, True, False])
    r   first)first_or_lastr   lastr   a  
        Indicator for whether the date is the first day of a quarter.

        Returns
        -------
        is_quarter_start : Series or DatetimeIndex
            The same type as the original data with boolean values. Series will
            have the same name and index. DatetimeIndex will have the same
            name.

        See Also
        --------
        quarter : Return the quarter of the date.
        is_quarter_end : Similar property for indicating the quarter end.

        Examples
        --------
        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on DatetimeIndex.

        >>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
        ...                   periods=4)})
        >>> df.assign(quarter=df.dates.dt.quarter,
        ...           is_quarter_start=df.dates.dt.is_quarter_start)
               dates  quarter  is_quarter_start
        0 2017-03-30        1             False
        1 2017-03-31        1             False
        2 2017-04-01        2              True
        3 2017-04-02        2             False

        >>> idx = pd.date_range('2017-03-30', periods=4)
        >>> idx
        DatetimeIndex(['2017-03-30', '2017-03-31', '2017-04-01', '2017-04-02'],
                      dtype='datetime64[us]', freq='D')

        >>> idx.is_quarter_start
        array([False, False,  True, False])
        r   a  
        Indicator for whether the date is the last day of a quarter.

        Returns
        -------
        is_quarter_end : Series or DatetimeIndex
            The same type as the original data with boolean values. Series will
            have the same name and index. DatetimeIndex will have the same
            name.

        See Also
        --------
        quarter : Return the quarter of the date.
        is_quarter_start : Similar property indicating the quarter start.

        Examples
        --------
        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on DatetimeIndex.

        >>> df = pd.DataFrame({'dates': pd.date_range("2017-03-30",
        ...                    periods=4)})
        >>> df.assign(quarter=df.dates.dt.quarter,
        ...           is_quarter_end=df.dates.dt.is_quarter_end)
               dates  quarter    is_quarter_end
        0 2017-03-30        1             False
        1 2017-03-31        1              True
        2 2017-04-01        2             False
        3 2017-04-02        2             False

        >>> idx = pd.date_range('2017-03-30', periods=4)
        >>> idx
        DatetimeIndex(['2017-03-30', '2017-03-31', '2017-04-01', '2017-04-02'],
                      dtype='datetime64[us]', freq='D')

        >>> idx.is_quarter_end
        array([False,  True, False, False])
        r   a  
        Indicate whether the date is the first day of a year.

        Returns
        -------
        Series or DatetimeIndex
            The same type as the original data with boolean values. Series will
            have the same name and index. DatetimeIndex will have the same
            name.

        See Also
        --------
        is_year_end : Similar property indicating the last day of the year.

        Examples
        --------
        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on DatetimeIndex.

        >>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
        >>> dates
        0   2017-12-30
        1   2017-12-31
        2   2018-01-01
        dtype: datetime64[us]

        >>> dates.dt.is_year_start
        0    False
        1    False
        2    True
        dtype: bool

        >>> idx = pd.date_range("2017-12-30", periods=3)
        >>> idx
        DatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'],
                      dtype='datetime64[us]', freq='D')

        >>> idx.is_year_start
        array([False, False,  True])

        This method, when applied to Series with datetime values under
        the ``.dt`` accessor, will lose information about Business offsets.

        >>> dates = pd.Series(pd.date_range("2020-10-30", periods=4, freq="BYS"))
        >>> dates
        0   2021-01-01
        1   2022-01-03
        2   2023-01-02
        3   2024-01-01
        dtype: datetime64[us]

        >>> dates.dt.is_year_start
        0    True
        1    False
        2    False
        3    True
        dtype: bool

        >>> idx = pd.date_range("2020-10-30", periods=4, freq="BYS")
        >>> idx
        DatetimeIndex(['2021-01-01', '2022-01-03', '2023-01-02', '2024-01-01'],
                      dtype='datetime64[us]', freq='BYS-JAN')

        >>> idx.is_year_start
        array([ True,  True,  True,  True])
        r   a{  
        Indicate whether the date is the last day of the year.

        Returns
        -------
        Series or DatetimeIndex
            The same type as the original data with boolean values. Series will
            have the same name and index. DatetimeIndex will have the same
            name.

        See Also
        --------
        is_year_start : Similar property indicating the start of the year.

        Examples
        --------
        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on DatetimeIndex.

        >>> dates = pd.Series(pd.date_range("2017-12-30", periods=3))
        >>> dates
        0   2017-12-30
        1   2017-12-31
        2   2018-01-01
        dtype: datetime64[us]

        >>> dates.dt.is_year_end
        0    False
        1     True
        2    False
        dtype: bool

        >>> idx = pd.date_range("2017-12-30", periods=3)
        >>> idx
        DatetimeIndex(['2017-12-30', '2017-12-31', '2018-01-01'],
                      dtype='datetime64[us]', freq='D')

        >>> idx.is_year_end
        array([False,  True, False])
        r   a  
        Boolean indicator if the date belongs to a leap year.

        A leap year is a year, which has 366 days (instead of 365) including
        29th of February as an intercalary day.
        Leap years are years which are multiples of four with the exception
        of years divisible by 100 but not by 400.

        Returns
        -------
        Series or ndarray
             Booleans indicating if dates belong to a leap year.

        See Also
        --------
        DatetimeIndex.is_year_end : Indicate whether the date is the
            last day of the year.
        DatetimeIndex.is_year_start : Indicate whether the date is the first
            day of a year.

        Examples
        --------
        This method is available on Series with datetime values under
        the ``.dt`` accessor, and directly on DatetimeIndex.

        >>> idx = pd.date_range("2012-01-01", "2015-01-01", freq="YE")
        >>> idx
        DatetimeIndex(['2012-12-31', '2013-12-31', '2014-12-31'],
                      dtype='datetime64[us]', freq='YE-DEC')
        >>> idx.is_leap_year
        array([ True, False, False])

        >>> dates_series = pd.Series(idx)
        >>> dates_series
        0   2012-12-31
        1   2013-12-31
        2   2014-12-31
        dtype: datetime64[us]
        >>> dates_series.dt.is_leap_year
        0     True
        1    False
        2    False
        dtype: bool
        npt.NDArray[np.float64]c                @   t          j        | j                  }t          j        | j                  }t          j        | j                  }|dk     }||xx         dz  cc<   ||xx         dz  cc<   |t          j        d|z  dz
  dz            z   d|z  z   t          j        |dz            z   t          j        |d	z            z
  t          j        |d
z            z   dz   | j        | j        dz  z   | j	        dz  z   | j
        dz  dz  z   | j        dz  dz  z   dz  z   S )a  
        Convert TimeStamp to a Julian Date.

        This method returns the number of days as a float since noon January 1, 4713 BC.

        https://en.wikipedia.org/wiki/Julian_day

        Returns
        -------
        ndarray or Index
            Float values that represent each date in Julian Calendar.

        See Also
        --------
        Timestamp.to_julian_date : Equivalent method on ``Timestamp`` objects.

        Examples
        --------
        >>> idx = pd.DatetimeIndex(["2028-08-12 00:54", "2028-08-12 02:06"])
        >>> idx.to_julian_date()
        Index([2461995.5375, 2461995.5875], dtype='float64')
        r   r	  rf      i     im     d   i  g   C:A<   i  i@B i ʚ;   )r[   asarrayr   rh   r   truncr   r   r   r   r   r   )rx   r   rh   r   testarrs        rO   to_julian_datezDatetimeArray.to_julian_date  sS   2 z$)$$
4:&&j""!)Wg"hec)Q.//0Dj htax  ! htcz""	#
 htcz""#  	+"#+$% "T)E12 /D(50	1 	
rQ   skipnakeepdimsr]   r^   r  r  c                    t                      j        |f||d|}|rWt          |t          j                  r=|dk    rddlm} |                    |          S |                     || j                  S |S )Nr  stdr   TimedeltaArrayr  )	r   _reducer   r[   r   r  r  r   r\   )rx   r]   r  r  rc  r|   r  r   s          rO   r  zDatetimeArray._reduce		  s     !RfxRR6RR 	E
62:66 	Eu}}======%44V<<<**6*DDDrQ   r	  ddofr  rC   c                   ddl m} | j        j        j                            dd          }t          j        |          }|                    | j                            |          |          }	|		                    |||||          S )aC	  
        Return sample standard deviation over requested axis.

        Normalized by `N-1` by default. This can be changed using ``ddof``.

        Parameters
        ----------
        axis : int, optional
            Axis for the function to be applied on. For :class:`pandas.Series`
            this parameter is unused and defaults to ``None``.
        dtype : dtype, optional, default None
            Type to use in computing the standard deviation. For arrays of
            integer type the default is float64, for arrays of float types
            it is the same as the array type.
        out : ndarray, optional, default None
            Alternative output array in which to place the result. It must have
            the same shape as the expected output but the type (of the
            calculated values) will be cast if necessary.
        ddof : int, default 1
            Degrees of Freedom. The divisor used in calculations is `N - ddof`,
            where `N` represents the number of elements.
        keepdims : bool, optional
            If this is set to True, the axes which are reduced are left in the
            result as dimensions with size one. With this option, the result
            will broadcast correctly against the input array. If the default
            value is passed, then keepdims will not be passed through to the
            std method of sub-classes of ndarray, however any non-default value
            will be. If the sub-class method does not implement keepdims any
            exceptions will be raised.
        skipna : bool, default True
            Exclude NA/null values. If an entire row/column is ``NA``, the result
            will be ``NA``.

        Returns
        -------
        Timedelta
            Standard deviation over requested axis.

        See Also
        --------
        numpy.ndarray.std : Returns the standard deviation of the array elements
            along given axis.
        Series.std : Return sample standard deviation over requested axis.

        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[us]', freq='D')
        >>> idx.std()
        Timedelta('1 days 00:00:00')
        r   r  r   timedelta64r  )axisoutr  r  r  )
r  r  rV  r\   r]   replacer[   r   r  r  )
rx   r  r\   r  r  r  r  r  	dtype_strtdas
             rO   r  zDatetimeArray.std	  s    F 	655555 M',44\=QQ	##((););E)B)B%(PPwwDcxPVwWWWrQ   )rJ   r   )rJ   r   )ry   r   rq   r   r\   rW   rJ   r   )r   r   rJ   r   )r   r   rq   r   r   r   r   r   r   r>   rJ   r   )NFr   r   r   )r   r   r   r   r   r>   r   r?   r   r=   rI   r@   rJ   r   )rJ   r)  )rJ   rR   )r   r   rJ   r)  )rJ   rW   )rJ   rV   )rJ   r   )rJ   r   )NN)rJ   r?  )rJ   r9   )T)r   r   )r[  r]  rJ   r^  )r   r   rJ   r   )rJ   rr  )rJ   r   )r   r   )r   r>   r   r?   rJ   r   )rJ   r^  rL   )rJ   rE   )rJ   rB   )rJ   r  )r]   r^   r  r   r  r   )NNNr	  FT)r  r  r  r   r  r   rJ   rC   )\r~   
__module____qualname__r   _typr   r[   r   _recognized_scalarsr   __annotations___infer_matchesr   r   r   ro   r   r   r   r   __array_priority__r   classmethodr   r(   r   r   r   r   r   r  r(  r,  r$  r3  r\   rH   setterr   r<  r>  rB  rQ  r  rd  r.  rq  rn   r   r   ravel_compatr   r~  r   r   r   r   r   r   r   r  r   r   rh   r   r   r   r   r   r   _dayofweek_docr   r   r   r   r   r   r   r   _is_month_docr`  r   r   r   r   r   r   r   r  r  r  __classcell__)r   s   @rO   r   r      s 	        1 1f D#R]38( 8( ( ( ( ( 8N/ / / X/    X  I      J    $ 766J6666Y+.D.D.DD     ( ( (    $ 
 6555#E####  [  #';G	      [( .2 N N N N N [N 
 >8;#*E E E E E [EN  #*'.(.{D {D {D {D {D {D [{D@A A A A, , , ,/ / / /      	 X* &/ &/ &/ X&/P Y
 
 Y
    X N N N XN D D D XD9 9 9 9 9 9 9% % % %:AD AD AD AD AD AD ADN (-$	
 	
 	
 	
 	
 	
   0$ $ $ $R
I 
I 
I 
IPK PK PK PKd 	 $+'.	vH vH vH vH vHvK K K K0. . . .`PM PM PM PM PMjB B B B BHC C C C CJ *L *L *L X*LX $T $T $T X$TL +L +L +L X+LZ) ) ) )V ?	 D8 O	 E8 /	 C: ?	 D: _	 F8 _	 F: "/	 K8 !	 J8!ND "/-GGKIG!/	! !KD Io	" "GF $O	 M:  K+MX %_*M,@,@w,@,W,W N #?(<(<6(<(R(R L '%	) )T %_%	) )NT $OA	E EML "/'	+ +KX #?+	/ /Lb/
 /
 /
 /
j ,0%        KX KX KX KX KX KX KX KX KXrQ   r   Fr   r   r   r:   r   r   r   r   r   r>   r    tuple[np.ndarray, tzinfo | None]c          	        t          | ||          \  } }t          | dd          }t          }|t          j        d| d          }|t
          k    st          |          rt          t          j        |           } d}t          j
        | d          dk    r |                     t          j                  } n|K|d	k    rEt          j        | t
          
          }	t          j        |	|||t!          |                    }
|
|fS t#          | ||d|          \  }}d}|r|r|}
n|r|}|}
nt%          ||||          \  }
}|
|fS | j        }t'          |t(                    r2t          t*          |           } t-          || j                  }| j        }
nt          j        |d          rMt'          | t*                    r| j        } t          t          j        |           } t%          | |||          \  }
}nb| j        t4          k    r#|                     t          j        d          } d}t          t          j        |           } |                     |          }
|r|
                                }
t'          |
t          j                  sJ t;          |
                      |
j        j        dk    sJ |
j        dk    sJ t?          |
j                  sJ |
|fS )aQ  
    Parameters
    ----------
    data : np.ndarray or ExtensionArray
        dtl.ensure_arraylike_for_datetimelike has already been called.
    copy : bool, default False
    tz : tzinfo or None, default None
    dayfirst : bool, default False
    yearfirst : bool, default False
    ambiguous : str, bool, or arraylike, default 'raise'
        See pandas._libs.tslibs.tzconversion.tz_localize_to_utc.
    out_unit : str or None, default None
        Desired output resolution.

    Returns
    -------
    result : numpy.ndarray
        The sequence converted to a numpy array with dtype ``datetime64[unit]``.
        Where `unit` is "ns" unless specified otherwise by `out_unit`.
    tz : tzinfo or None
        Either the user-provided tzinfo or one inferred from the data.

    Raises
    ------
    TypeError : PeriodDType data is passed
    r+  r\   NrY   rZ   F)r  integerr   r  )rH   r   r   r  )r   r   allow_objectr   )rH   r   r   r   rS  M8) maybe_convert_dtyper6  r(   r[   r\   rA  r,   r
   r   r   infer_dtyper  r  r  r   array_to_datetime_with_tzr#   objects_to_datetime64_construct_from_dt64_naiver   r.   r   _maybe_infer_tzrH   rV  r   r)   r  r   rW  r   r   )r   r   rH   r   r   r   r   r   	out_dtypeobj_datar|   rP  inferred_tz_s                 rO   r   r   h	  s   L %T4B777JD$w--JIH.8...//	Vz:: BJ%%?4...);;;;rx((DD^	W 4 4z$f555H4!#(22  F 2:%:!#"!& & &"I{ D k  #  " 7"49  	 2:Z
 *o.. &M4((R))	S	)	) &dM** 	!=DBJ%%1Rdi
 
 
 :$$;;rxe;44DDBJ%%9%% fbj))774<<77)<####<4fl+++++2:rQ   r?  tuple[np.ndarray, bool]c               X   | j         }t          |          s#t          |          }t          | |d          } d}| j         j        dk    r6|                     | j                             d                    } | j         }d}|| j        }| j        dk    r| 	                                } t          |          }t          j        |                     d          |||          } |                     |          } |                     |          } | j         |k    sJ | j                     | }||fS )	zP
    Convert datetime64 data to a supported dtype, localizing if necessary.
    Fr   ><Nr	  r  )r   r  )r\   r   r   r   	byteorderr  newbyteordershaperF  ravelr   r"   r  r  reshape)r   rH   r   r   	new_dtyper  r   r|   s           rO   r  r  	  s-    
Ii(( '	22	"4yuEEEzs"" {{4:2237788J		~ 
9q==::<<D'	22	.IIdOOR9I
 
 
 yy##||E"":"""DJ"""F4<rQ   utcerrorsr;   r  c           
     >   |dv sJ t          j        | t           j                  } t          j        | ||||t          |                    \  }}|||fS |j        j        dk    r||fS |j        t          k    r|r||fS t          d          t          |          )a  
    Convert data to array of timestamps.

    Parameters
    ----------
    data : np.ndarray[object]
    dayfirst : bool
    yearfirst : bool
    utc : bool, default False
        Whether to convert/localize timestamps to UTC.
    errors : {'raise', 'coerce'}
    allow_object : bool
        Whether to return an object-dtype ndarray instead of raising if the
        data contains more than one timezone.
    out_unit : str or None, default None
        None indicates we should do resolution inference.

    Returns
    -------
    result : ndarray
        np.datetime64[out_unit] if returned values represent wall times or UTC
        timestamps.
        object if mixed timezones
    inferred_tz : tzinfo or None
        If not None, then the datetime64 values in `result` denote UTC timestamps.

    Raises
    ------
    ValueError : if data cannot be converted to datetimes
    TypeError  : When a type cannot be converted to datetime
    )r   coercer  )r  r  r   r   r  Nr   z!DatetimeIndex has mixed timezones)
r[   r  object_r   array_to_datetimer#   r\   r   rA  rU  )	r   r   r   r  r  r  r   r|   	tz_parseds	            rO   r  r  
  s    P ((((( :d"*---D/ **  FI  y  		c	!	!y  			  	%9$$;<<< rQ   c                D   t          | d          s| |fS t          | j                  r0|                     t                                        d          } d}nt          j        | j        d          st          | j                  rt          d| j         d          t          | j        t                    rt          d          t          | j        t                    r<t          | j        t                    s"t          j        | t          j                  } d}| |fS )	a\  
    Convert data based on dtype conventions, issuing
    errors where appropriate.

    Parameters
    ----------
    data : np.ndarray or pd.Index
    copy : bool
    tz : tzinfo or None, default None

    Returns
    -------
    data : np.ndarray or pd.Index
    copy : bool

    Raises
    ------
    TypeError : PeriodDType data is passed
    r\   r  Fr  zdtype z& cannot be converted to datetime64[ns]zFPassing PeriodDtype data is invalid. Use `data.to_timestamp()` insteadr  )r  r+   r\   r  r(   r  r   r   r*   rU  r   r0   r/   r.   r[   r  r  )r   r   rH   s      rO   r  r  ]
  s   ( 4!! Tzdj!! 
 {{<((--d33	S	)	) ]4:-F-F SSSSTTT	DJ	,	,  T
 
 	
 
DJ	/	/ 

O9 9  xBJ///:rQ   r  c                j    | |} n-|n*t          j        | |          st          d| d|            | S )aV  
    If a timezone is inferred from data, check that it is compatible with
    the user-provided timezone, if any.

    Parameters
    ----------
    tz : tzinfo or None
    inferred_tz : tzinfo or None

    Returns
    -------
    tz : tzinfo or None

    Raises
    ------
    TypeError : if both timezones are present but do not match
    Nzdata is already tz-aware z, unable to set specified tz: )r   
tz_comparerU  )rH   r  s     rO   r  r  
  s[    $ 
z		!"k22 
WWWSUWW
 
 	
 IrQ   c                   | t          |           } | t          j        d          k    rd}t          |          t	          | t          j                  r| j        dk    s0t          |           r!t	          | t          j        t          f          st          d|  d          t          | dd          rBt          t          |           } t          | j
        t          j        | j                            } | S )	a  
    Check that a dtype, if passed, represents either a numpy datetime64[ns]
    dtype or a pandas DatetimeTZDtype.

    Parameters
    ----------
    dtype : object

    Returns
    -------
    dtype : None, numpy.dtype, or DatetimeTZDtype

    Raises
    ------
    ValueError : invalid dtype

    Notes
    -----
    Unlike _validate_tz_from_dtype, this does _not_ allow non-existent
    tz errors to go through
    Nr  zhPassing in 'datetime64' dtype with no precision is not allowed. Please pass in 'datetime64[ns]' instead.r   zUnexpected value for 'dtype': 'ze'. Must be 'datetime64[s]', 'datetime64[ms]', 'datetime64[us]', 'datetime64[ns]' or DatetimeTZDtype'.rH   )rI   rH   )r-   r[   r\   r   r   r   r   r.   r6  r
   rI   r   tz_standardizerH   )r\   msgs     rO   r   r   
  s
   , U##BHTNN"";  S//! ubh''	s""*<U*C*C"EBHo#>?? #8% 8 8 8   5$%% 		 %00E#ZI$<UX$F$F  E LrQ   r   c                   | t          | t                    r&	 t          j        |           } n# t          $ r Y nw xY wt          | dd          }|9|$t          j        ||          st          d          |rt          d          |}|;t          j
        | d          r&|$t          j        ||          st          d          |S )a  
    If the given dtype is a DatetimeTZDtype, extract the implied
    tzinfo object from it and check that it does not conflict with the given
    tz.

    Parameters
    ----------
    dtype : dtype, str
    tz : None, tzinfo
    explicit_tz_none : bool, default False
        Whether tz=None was passed explicitly, as opposed to lib.no_default.

    Returns
    -------
    tz : consensus tzinfo

    Raises
    ------
    ValueError : on tzinfo mismatch
    NrH   z-cannot supply both a tz and a dtype with a tzz3Cannot pass both a timezone-aware dtype and tz=Noner   zHcannot supply both a tz and a timezone-naive dtype (i.e. datetime64[ns]))r   r^   r.   construct_from_stringrU  r6  r   r  r   r   r   )r\   rH   r   dtzs       rO   r   r   
  s    . eS!! 	'=eDD   
  eT4((?~i&:2s&C&C~ !PQQQ X !VWWWB>coeS99> ~i&:2s&C&C~ A  
 Is   . 
;;rd   r   re   c                "   	 t          j        | |          }n"# t          $ r}t          d          |d}~ww xY wt          j        |          }t          j        |          }|'|%t          j        ||          st          d          n||}|S )a  
    If a timezone is not explicitly given via `tz`, see if one can
    be inferred from the `start` and `end` endpoints.  If more than one
    of these inputs provides a timezone, require that they all agree.

    Parameters
    ----------
    start : Timestamp
    end : Timestamp
    tz : tzinfo or None

    Returns
    -------
    tz : tzinfo or None

    Raises
    ------
    TypeError : if start and end timezones do not agree
    z>Start and end cannot both be tz-aware with different timezonesNz0Inferred time zone not equal to passed time zone)r   infer_tzinfoAssertionErrorrU  r   r  )rd   re   rH   r  errs        rO   r  r    s    ,,UC88   L
 
	 (55K			#	#B	~+1#K44 	U !STTT	U 
	 Is    
727r   )tuple[_TimestampNoneT1, _TimestampNoneT2]c                f    |r,| |                                  } ||                                 }| |fS rL   )r   )rd   re   r   s      rO   r  r  J  s=      "OO%%E?--//C#:rQ   r2  Timestamp | Nonec                    | @| j         9|dk    r|nd}||dd}t          |t                    s|||d<    | j        di |} | S )a  
    Localize a start or end Timestamp to the timezone of the corresponding
    start or end Timestamp

    Parameters
    ----------
    ts : start or end Timestamp to potentially localize
    freq : Tick, DateOffset, or None
    tz : str, timezone object or None
    ambiguous: str, localization behavior for ambiguous times
    nonexistent: str, localization behavior for nonexistent times

    Returns
    -------
    ts : Timestamp
    Nr  F)r   r   rH   rH   rM   )r   r   r6   r   )r2  rq   rH   r   r   localize_argss         rO   r  r  W  sq    , 
~")+ "+g!5!5II5	&/SWXXdD!! 	%T\"$M$R^,,m,,IrQ   r   r   r   r   Generator[Timestamp]c             #    K   t          |          }t          |           } | t          ur|                     |          } nd} t          |          }|t          ur|                    |          }nd}| rK|                    |           s6|j        dk    r|                    |           } n|                    |           } ||| k     r|j        dk    rd}d}|| |dz
  |z  z   }| ||dz
  |z  z
  } t          t          |           } t          t          |          }| }|j        dk    ra||k    rY|V  ||k    rdS |	                    |          }|                    |          }||k    rt          d| d          |}||k    WdS dS ||k    rY|V  ||k    rdS |	                    |          }|                    |          }||k    rt          d| d          |}||k    WdS dS )a  
    Generates a sequence of dates corresponding to the specified time
    offset. Similar to dateutil.rrule except uses pandas DateOffset
    objects to represent time increments.

    Parameters
    ----------
    start : Timestamp or None
    end : Timestamp or None
    periods : int or None
    offset : DateOffset
    unit : str

    Notes
    -----
    * This method is faster for generating weekdays than dateutil.rrule
    * At least two of (start, end, periods) must be specified.
    * If both start and end are specified, the returned dates will
    satisfy start <= date <= end.

    Returns
    -------
    dates : generator object
    Nr   r	  zOffset z did not increment datez did not decrement date)r    r   r   r   is_on_offsetnrollforwardrollbackr
   _applyr   )rd   re   r   r   rI   cur	next_dates          rO   r  r  x  sW     @ vF eECd## C..C
#~~kk$ +V((// +
 8q==&&u--EEOOE**E 3;;68q==
{ w{f,,} w{f,,E""E
y#

C
Cx1}}SjjIIIczz  c**I!))$//IC !J6!J!J!JKKKC Sjjjjjj SjjIIIczz  c**I!))$//IC !J6!J!J!JKKKC SjjjjjjrQ   ).)rH   r   rI   r@   rJ   r.   )rH   rR   rI   r@   rJ   rS   )rU   )rH   rV   rI   r@   rJ   rW   rL   )r]   r^   r_   r^   r`   ra   )r   r:   r   r   rH   rV   r   r   r   r   r   r>   r   ra   rJ   r  )
r   r?  rH   rV   r   r   r   r>   rJ   r  )Fr   FN)r   r?  r  r   r  r;   r  r   r   ra   rJ   r  )r   r   rH   rV   )rH   rV   r  rV   rJ   rV   )F)rH   rV   r   r   rJ   rV   )rd   r   re   r   rH   rV   rJ   rV   )rd   rF   re   rG   r   r   rJ   r  )r2  r  rJ   r  )rd   r  re   r  r   r   r   r   rI   r@   rJ   r  )r
__future__r   r   r   r   typingr   r   r	   r
   r   ro  numpyr[   pandas._configr   pandas._config.configr   pandas._libsr   r   pandas._libs.tslibsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   r"   pandas._libs.tslibs.dtypesr#   pandas.errorsr$   pandas.util._decoratorsr%   pandas.util._exceptionsr&   pandas.util._validatorsr'   pandas.core.dtypes.commonr(   r)   r*   r+   r,   r-   pandas.core.dtypes.dtypesr.   r/   r0   pandas.core.dtypes.missingr1   r  r2   r   pandas.core.arrays._rangesr3   pandas.core.commoncorecommonr  pandas.tseries.frequenciesr4   pandas.tseries.offsetsr5   r6   collections.abcr7   r8   r9   pandas._typingr:   r;   r<   r=   r>   r?   r@   rA   r  rB   rC   rE   rF   rG   rH  rP   r   TimelikeOpsDatelikeOpsr   r   r  r  r  r  r   r   r  r  r  r  rM   rQ   rO   <module>r6     s>   " " " " " "         
                   - - - - - - , , , , , ,                                                * : 9 9 9 9 9 , , , , , , . . . . . . 4 4 4 4 4 4 6 6 6 6 6 6                        
 , + + + + + 2 2 2 2 2 2 = = = = = =                   7 7 7 7 7 7       
  D         	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	        /.....w19dCCw19dCC  
 I I I I 
 I 
 O O O O 
 O )-1 1 1 1 1*" " " " "J Oq"X q"X q"X q"X q"XCOS_ q"X q"X q"XvE &{ { { { { {|) ) ) )` #*H  H  H  H  H V1 1 1 1 1p   :5 5 5r 8=2 2 2 2 2j( ( ( (V
 
 
 
   Bl l l l l lrQ   