o
    �¨ÊhÈ\ ã                   @  sª  d dl mZ d dlmZmZ d dlmZ d dlZd dlmZm	Z	m
Z
mZmZmZmZmZ d dlZd dlZd dlmZmZ d dl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) d d	l*m+Z+m,Z, d d
l-m.Z. d dl/m0Z0 d dl1m2Z2 d dl3m4Z4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;m<Z<m=Z=m>Z>m?Z?m@Z@mAZAmBZBmCZC d dlDmEZF d dlGmHZHmIZImJZJ d dlKmLZLmMZMmNZN d dlOmPZP d dlQmRZR d dlSmTZTmUZUmVZVmWZWmXZXmYZY d dlZm[Z[m\Z\m]Z]m^Z^m_Z_ d dl`maZambZb d dlcmdZdmeZe d dlfmgZgmhZhmiZimjZj d dlkmlZlmmZmmnZn d dlompZp d dlqmrZr d dlsmtZtmuZu d dlvmwZw d dlxmyZy d dlzm{Z{ d dl|m}  m~Z d dl€m�Z‚mƒZƒm„Z„ d d l…m†Z†m‡Z‡ d d!lˆm‰Z‰ d d"lŠm‹Z‹mŒZŒ d d#l�mŽZŽ e�r€d d$l�m�Z�m‘Z‘ d d%l’m“Z“ d d&l”m•Z•m–Z–m—Z— ee6ef Z˜dSd)d*„Z™dTd.d/„ZšG d0d1„ d1eretƒZ›G d2d3„ d3e›ƒZœd4Z�d5Zžd6ZŸd7Z G d8d9„ d9e›ƒZ¡dUd>d?„Z¢edVdBdC„ƒZ£edWdFdC„ƒZ£dXdIdC„Z£dYdMdN„Z¤dZdQdR„Z¥dS )[é    )Úannotations)ÚdatetimeÚ	timedelta)ÚwrapsN)ÚTYPE_CHECKINGÚAnyÚCallableÚLiteralÚUnionÚcastÚfinalÚoverload)ÚalgosÚlib)ÚNDArrayBacked)Ú
BaseOffsetÚIncompatibleFrequencyÚNaTÚNaTTypeÚPeriodÚ
ResolutionÚTickÚ	TimedeltaÚ	TimestampÚadd_overflowsafeÚastype_overflowsafeÚget_unit_from_dtypeÚiNaTÚints_to_pydatetimeÚints_to_pytimedeltaÚperiods_per_dayÚ	to_offset)ÚRoundToÚround_nsint64)Úcompare_mismatched_resolutions)Úget_unit_for_round)Úinteger_op_not_supported)Ú	ArrayLikeÚAxisIntÚDatetimeLikeScalarÚDtypeÚDtypeObjÚFÚInterpolateOptionsÚNpDtypeÚPositionalIndexer2DÚPositionalIndexerTupleÚScalarIndexerÚSelfÚSequenceIndexerÚTimeAmbiguousÚTimeNonexistentÚnpt)Úfunction)ÚAbstractMethodErrorÚInvalidComparisonÚPerformanceWarning)ÚAppenderÚSubstitutionÚcache_readonly)Úfind_stack_level)Ú'construct_1d_object_array_from_listlike)Úis_all_stringsÚis_integer_dtypeÚis_list_likeÚis_object_dtypeÚis_string_dtypeÚpandas_dtype)Ú
ArrowDtypeÚCategoricalDtypeÚDatetimeTZDtypeÚExtensionDtypeÚPeriodDtype)ÚABCCategoricalÚABCMultiIndex)Úis_valid_na_for_dtypeÚisna)Ú
algorithmsÚmissingÚnanopsÚops)ÚisinÚ	map_arrayÚunique1d)Údatetimelike_accumulations)ÚOpsMixin)ÚNDArrayBackedExtensionArrayÚravel_compat)ÚArrowExtensionArray)ÚExtensionArray)ÚIntegerArray)ÚarrayÚensure_wrapped_if_datetimelikeÚextract_array)Úcheck_array_indexerÚcheck_setitem_lengths)Úunpack_zerodim_and_defer)Úinvalid_comparisonÚmake_invalid_op)Úfrequencies)ÚIteratorÚSequence©ÚIndex)ÚDatetimeArrayÚPeriodArrayÚTimedeltaArrayÚop_nameÚstrc                 C  s   t | ƒ}t| ƒ|ƒS ©N)rd   rb   )rm   Úop© rq   úQ/var/www/html/env/lib/python3.10/site-packages/pandas/core/arrays/datetimelike.pyÚ_make_unpacked_invalid_op¤   s   rs   Úmethr,   Úreturnc                   s   t ˆ ƒ‡ fdd„ƒ}tt|ƒS )zâ
    For PeriodArray methods, dispatch to DatetimeArray and re-wrap the results
    in PeriodArray.  We cannot use ._ndarray directly for the affected
    methods because the i8 data has different semantics on NaT values.
    c                   sx   t | jtƒsˆ | g|¢R i |¤ŽS |  d¡}ˆ |g|¢R i |¤Ž}|tu r'tS t |tƒr2|  |j¡S | d¡}|  |¡S )NúM8[ns]Úi8)	Ú
isinstanceÚdtyperJ   Úviewr   r   Ú	_box_funcÚ_valueÚ_from_backing_data)ÚselfÚargsÚkwargsÚarrÚresultÚres_i8©rt   rq   rr   Únew_meth°   s   



z"_period_dispatch.<locals>.new_meth)r   r   r,   )rt   r…   rq   r„   rr   Ú_period_dispatch©   s   
r†   c                      sò  e Zd ZU dZded< ded< ded< ded	< d
ed< edödd„ƒZ	d÷dødd„Zedùdd„ƒZ	dúdd„Z
dûd!d"„Zdüd$d%„Zd&d'„ Zdýd(d)„Zdþd+d,„Zedÿd.d/„ƒZd0dd1œ�d d5d6„Z�d�dd8d9„Z	�d�dd<d=„Ze�dd@dA„ƒZe�ddDdA„ƒZ�d‡ fdHdA„Z�ddIdJ„Z�d	‡ fdMdN„Z�d
dOdP„Z�d�d‡ fdRdS„Ze�ddTdU„ƒZe�ddXdU„ƒZe�dd[dU„ƒZe�d�dd^dU„ƒZ�d�d‡ fd_dU„Zd`da„ ZddQdbœ�ddedf„Z�d�ddgdh„Z�d�ddjdk„Zdldm„ Ze �ddodp„ƒZ!e"�ddqdr„ƒZ#�ddudv„Z$�ddwdx„Z%e�ddydz„ƒZ&edöd{d|„ƒZ'e(df�dd~d„Z)e�dd�d‚„ƒZ*e�ddƒd„„ƒZ+e�dd†d‡„ƒZ,e�ddˆd‰„ƒZ-edödŠd‹„ƒZ.edödŒd�„ƒZ/edödŽd�„ƒZ0d�d‘„ Z1e2d’ƒZ3e2d“ƒZ4e2d”ƒZ5e2d•ƒZ6e2d–ƒZ7e2d—ƒZ8e2d˜ƒZ9e2d™ƒZ:e2dšƒZ;e2d›ƒZ<e2dœƒZ=e2d�ƒZ>e �ddŸd „ƒZ?e �dd¡d¢„ƒZ@e �dd£d¤„ƒZAe �dd¥d¦„ƒZBe �d d¨d©„ƒZCe �d!dªd«„ƒZDe �d"d­d®„ƒZEe �d#d±d²„ƒZFd³d´„ ZGdµd¶„ ZH�d$d·d¸„ZIe �d%dºd»„ƒZJe d¼d½„ ƒZKe d¾d¿„ ƒZLe �d&dÁdÂ„ƒZMe �d'dÃdÄ„ƒZNdQdÅœ�d(dÈdÉ„ZOePdÊƒdËdÌ„ ƒZQdÍdÎ„ ZRePdÏƒdÐdÑ„ ƒZSdÒdÓ„ ZT�ddÔdÕ„ZU�ddÖd×„ZVeW�d)‡ fdÛdÜ„ƒZXeWddQdÝœ�d*dàdá„ƒZYeWddQdÝœ�d*dâdã„ƒZZdQdädåœ�d+dædç„Z[eWddQdÝœ�d*dèdé„ƒZ\�d�d,dëdì„Z]�d-dôdõ„Z^‡  Z_S (.  ÚDatetimeLikeArrayMixinzÈ
    Shared Base/Mixin class for DatetimeArray, TimedeltaArray, PeriodArray

    Assumes that __new__/__init__ defines:
        _ndarray

    and that inheriting subclass implements:
        freq
    ztuple[str, ...]Ú_infer_matcheszCallable[[DtypeObj], bool]Ú_is_recognized_dtypeztuple[type, ...]Ú_recognized_scalarsú
np.ndarrayÚ_ndarrayúBaseOffset | NoneÚfreqru   Úboolc                 C  s   dS )NTrq   ©r~   rq   rq   rr   Ú_can_hold_naØ   ó   z#DatetimeLikeArrayMixin._can_hold_naNFry   úDtype | NoneÚcopyÚNonec                 C  ó   t | ƒ‚ro   ©r8   )r~   Údatary   rŽ   r”   rq   rq   rr   Ú__init__Ü   s   zDatetimeLikeArrayMixin.__init__útype[DatetimeLikeScalar]c                 C  r–   )z£
        The scalar associated with this datelike

        * PeriodArray : Period
        * DatetimeArray : Timestamp
        * TimedeltaArray : Timedelta
        r—   r�   rq   rq   rr   Ú_scalar_typeá   s   	z#DatetimeLikeArrayMixin._scalar_typeÚvaluern   ÚDTScalarOrNaTc                 C  r–   )ay  
        Construct a scalar type from a string.

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

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

        Notes
        -----
        This should call ``self._check_compatible_with`` before
        unboxing the result.
        r—   ©r~   rœ   rq   rq   rr   Ú_scalar_from_stringì   ó   z*DatetimeLikeArrayMixin._scalar_from_stringú)np.int64 | np.datetime64 | np.timedelta64c                 C  r–   )a´  
        Unbox the integer value of a scalar `value`.

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

        Returns
        -------
        int

        Examples
        --------
        >>> arr = pd.array(np.array(['1970-01-01'], 'datetime64[ns]'))
        >>> arr._unbox_scalar(arr[0])
        numpy.datetime64('1970-01-01T00:00:00.000000000')
        r—   rž   rq   rq   rr   Ú_unbox_scalar   s   z$DatetimeLikeArrayMixin._unbox_scalarÚotherc                 C  r–   )a|  
        Verify that `self` and `other` are compatible.

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

        In each case, NaT is considered compatible.

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

        Raises
        ------
        Exception
        r—   ©r~   r£   rq   rq   rr   Ú_check_compatible_with  r    z-DatetimeLikeArrayMixin._check_compatible_withc                 C  r–   )zI
        box function to get object from internal representation
        r—   )r~   Úxrq   rq   rr   r{   -  ó   z DatetimeLikeArrayMixin._box_funcc                 C  s   t j|| jdd�S )z1
        apply box func to passed values
        F)Úconvert)r   Ú	map_inferr{   )r~   Úvaluesrq   rq   rr   Ú_box_values3  s   z"DatetimeLikeArrayMixin._box_valuesrf   c                   s8   ˆ j dkr‡ fdd„ttˆ ƒƒD ƒS ‡ fdd„ˆ jD ƒS )Né   c                 3  s   � | ]}ˆ | V  qd S ro   rq   )Ú.0Únr�   rq   rr   Ú	<genexpr>;  s   € z2DatetimeLikeArrayMixin.__iter__.<locals>.<genexpr>c                 3  s   � | ]}ˆ   |¡V  qd S ro   )r{   )r­   Úvr�   rq   rr   r¯   =  s   € )ÚndimÚrangeÚlenÚasi8r�   rq   r�   rr   Ú__iter__9  s   
zDatetimeLikeArrayMixin.__iter__únpt.NDArray[np.int64]c                 C  s   | j  d¡S )z‘
        Integer representation of the values.

        Returns
        -------
        ndarray
            An ndarray with int64 dtype.
        rw   )rŒ   rz   r�   rq   rq   rr   r´   ?  s   zDatetimeLikeArrayMixin.asi8r   )Úna_repÚdate_formatr·   ústr | floatúnpt.NDArray[np.object_]c                C  r–   )z|
        Helper method for astype when converting to strings.

        Returns
        -------
        ndarray[str]
        r—   )r~   r·   r¸   rq   rq   rr   Ú_format_native_typesO  s   
z+DatetimeLikeArrayMixin._format_native_typesÚboxedc                 C  s   dj S )Nz'{}')Úformat)r~   r¼   rq   rq   rr   Ú
_formatter[  s   z!DatetimeLikeArrayMixin._formatterúNpDtype | Noneúbool | Nonec                 C  s    t |ƒrtjt| ƒtd�S | jS )N©ry   )rC   Únpr]   ÚlistÚobjectrŒ   )r~   ry   r”   rq   rq   rr   Ú	__array__b  s   z DatetimeLikeArrayMixin.__array__Úitemr1   c                 C  ó   d S ro   rq   ©r~   rÆ   rq   rq   rr   Ú__getitem__j  r’   z"DatetimeLikeArrayMixin.__getitem__ú(SequenceIndexer | PositionalIndexerTupler2   c                 C  rÇ   ro   rq   rÈ   rq   rq   rr   rÉ   n  s   Úkeyr/   úSelf | DTScalarOrNaTc                   s:   t dtƒ  |¡ƒ}t |¡r|S t t|ƒ}|  |¡|_|S )z’
        This getitem defers to the underlying array, which by-definition can
        only handle list-likes, slices, and integer scalars
        zUnion[Self, DTScalarOrNaT])r   ÚsuperrÉ   r   Ú	is_scalarr2   Ú_get_getitem_freqÚ_freq)r~   rË   r‚   ©Ú	__class__rq   rr   rÉ   u  s   

c                 C  s¸   t | jtƒ}|r| j}|S | jdkrd}|S t| |ƒ}d}t |tƒr9| jdur4|jdur4|j| j }|S | j}|S |tu rB| j}|S t	 
|¡rZt | tj¡¡}t |tƒrZ|  |¡S |S )z\
        Find the `freq` attribute to assign to the result of a __getitem__ lookup.
        r¬   N)rx   ry   rJ   rŽ   r±   r`   ÚsliceÚstepÚEllipsisÚcomÚis_bool_indexerr   Úmaybe_booleans_to_slicerz   rÂ   Úuint8rÏ   )r~   rË   Ú	is_periodrŽ   Únew_keyrq   rq   rr   rÏ   †  s.   
î
ñ
÷	ø
ü

z(DatetimeLikeArrayMixin._get_getitem_freqú,int | Sequence[int] | Sequence[bool] | sliceúNaTType | Any | Sequence[Any]c                   s.   t ||| ƒ}tƒ  ||¡ |rd S |  ¡  d S ro   )ra   rÍ   Ú__setitem__Ú_maybe_clear_freq)r~   rË   rœ   Úno_oprÑ   rq   rr   rÞ   ¤  s
   z"DatetimeLikeArrayMixin.__setitem__c                 C  rÇ   ro   rq   r�   rq   rq   rr   rß   º  s   z(DatetimeLikeArrayMixin._maybe_clear_freqTc                   s,  t |ƒ}|tkr;| jjdkr"td| ƒ} | j}t|| jd| jd�}|S | jjdkr/t	| j
dd�S |  | j ¡ ¡ | j¡S t|tƒrHtƒ j||d�S t|ƒrP|  ¡ S |jd	v rq| j}|tjkritd
| j› d|› d�ƒ‚|ro| ¡ }|S |jdv r{| j|ks€|jdkr�dt| ƒj› d|› �}t|ƒ‚tj| |d�S )NÚMrj   Ú	timestamp)ÚtzÚboxÚresoÚmT)rä   ©r”   ÚiuzConverting from z to z? is not supported. Do obj.astype('int64').astype(dtype) insteadÚmMÚfzCannot cast z
 to dtype rÁ   )rE   rÄ   ry   Úkindr   r´   r   rã   Ú_cresor   rŒ   r«   ÚravelÚreshapeÚshaperx   rI   rÍ   ÚastyperD   r»   rÂ   Úint64Ú	TypeErrorr”   ÚtypeÚ__name__Úasarray)r~   ry   r”   Úi8dataÚ	convertedrª   ÚmsgrÑ   rq   rr   rð   ¿  s@   
ü


ÿzDatetimeLikeArrayMixin.astypec                 C  rÇ   ro   rq   r�   rq   rq   rr   rz   ò  r’   zDatetimeLikeArrayMixin.viewúLiteral['M8[ns]']rj   c                 C  rÇ   ro   rq   ©r~   ry   rq   rq   rr   rz   ö  r’   úLiteral['m8[ns]']rl   c                 C  rÇ   ro   rq   rú   rq   rq   rr   rz   ú  r’   .r'   c                 C  rÇ   ro   rq   rú   rq   rq   rr   rz   þ  r’   c                   s   t ƒ  |¡S ro   )rÍ   rz   rú   rÑ   rq   rr   rz     s   c              
   C  s  t |tƒrz|  |¡}W n ttfy   t|ƒ‚w t || jƒs$|tu rE|  |¡}z|  	|¡ W |S  t
tfyD } zt|ƒ|‚d }~ww t|ƒsMt|ƒ‚t|ƒt| ƒkrYtdƒ‚z| j|dd�}|  	|¡ W |S  t
tfy‹ } ztt|dd ƒƒr{nt|ƒ|‚W Y d }~|S d }~ww )NzLengths must matchT)Úallow_objectry   )rx   rn   rŸ   Ú
ValueErrorr   r9   rŠ   r   r›   r¥   rò   rB   r³   Ú_validate_listlikerC   Úgetattr)r~   r£   Úerrrq   rq   rr   Ú_validate_comparison_value  s>   
þ
ë
€þù

þ€ùz1DatetimeLikeArrayMixin._validate_comparison_value)Úallow_listlikeÚunboxr  r  c             
   C  sÂ   t || jƒrnQt |tƒr+z|  |¡}W nD ty* } z|  ||¡}t|ƒ|‚d}~ww t|| jƒr4t	}n$t
|ƒrB|  ||¡}t|ƒ‚t || jƒrN|  |¡}n
|  ||¡}t|ƒ‚|s\|S |  |¡S )a  
        Validate that the input value can be cast to our scalar_type.

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

        Returns
        -------
        self._scalar_type or NaT
        N)rx   r›   rn   rŸ   rý   Ú_validation_error_messagerò   rM   ry   r   rN   rŠ   r¢   )r~   rœ   r  r  r   rø   rq   rq   rr   Ú_validate_scalar0  s,   

€þ
z'DatetimeLikeArrayMixin._validate_scalarc                 C  sr   t |dƒrt|ddƒdkr|j› d�}n	dt|ƒj› d�}|r,d| jj› d|› d�}|S d| jj› d	|› d�}|S )
a+  
        Construct an exception message on validation error.

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

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

        Returns
        -------
        str
        ry   r±   r   z arrayú'zvalue should be a 'z!', 'NaT', or array of those. Got z	 instead.z' or 'NaT'. Got )Úhasattrrÿ   ry   ró   rô   r›   )r~   rœ   r  Úmsg_gotrø   rq   rq   rr   r  m  s   ÿÿ	ýÿÿz0DatetimeLikeArrayMixin._validation_error_messagerü   c              	   C  s   t |t| ƒƒr| jjdv r|s|j| jdd�}|S t |tƒr.t|ƒdkr.t| ƒjg | jd�S t	|dƒrc|jt
krct |¡| jv rcz	t| ƒ |¡}W n ttfyb   |rX| Y S |  |d¡}t|ƒ‚w t|dd�}t|ƒ}t|dd�}t|ƒr�zt| ƒj|| jd�}W n	 tyŒ   Y nw t |jtƒr¤|jj| jkr¤| ¡ }t|dd�}|r¬t|jƒr¬nt| ƒ |j¡s¾|  |d¡}t|ƒ‚| jjdv rÎ|sÎ|j| jdd�}|S )	Nré   F©Úround_okr   rÁ   ry   T©Úextract_numpy)rx   ró   ry   rë   Úas_unitÚunitrÃ   r³   Ú_from_sequencer  rÄ   r   Úinfer_dtyperˆ   rý   rò   r  r_   Úpd_arrayr@   rG   Ú
categoriesÚ_internal_get_valuesrC   r‰   )r~   rœ   rü   rø   rq   rq   rr   rþ   Œ  sJ   ü	ÿz)DatetimeLikeArrayMixin._validate_listlikec                 C  s,   t |ƒr
|  |¡}n| j|dd�S |  |¡S )NT)r  )rB   rþ   r  Ú_unboxrž   rq   rq   rr   Ú_validate_setitem_valueÆ  s   
z.DatetimeLikeArrayMixin._validate_setitem_valueú6np.int64 | np.datetime64 | np.timedelta64 | np.ndarrayc                 C  s,   t  |¡r|  |¡}|S |  |¡ |j}|S )zZ
        Unbox either a scalar with _unbox_scalar or an instance of our own type.
        )r   rÎ   r¢   r¥   rŒ   r¤   rq   rq   rr   r  Î  s   


þzDatetimeLikeArrayMixin._unboxc                 C  s:   ddl m} t| ||d�}||ƒ}t|tƒr| ¡ S |jS )Nr   rh   )Ú	na_action)Úpandasri   rT   rx   rL   Úto_numpyr]   )r~   Úmapperr  ri   r‚   rq   rq   rr   Úmapà  s   
zDatetimeLikeArrayMixin.maprª   únpt.NDArray[np.bool_]c              	   C  sj  |j jdv rtj| jtd�S t|ƒ}t|t| ƒƒs‚g d¢}|j t	krYt
j|d| j d�}|j t	kr5|  |¡S t
j|dd�}||vrY|dkrEnd	|v rQt|  t	¡|ƒS tj| jtd�S z	t| ƒ |¡}W n tys   t|  t	¡|ƒ Y S w tjd
| j › d�ttƒ d� | j jdv r“td| ƒ} | | j¡}z|  |¡ W n ttfy­   tj| jtd� Y S w t| j|jƒS )z÷
        Compute boolean array of whether each value is found in the
        passed set of values.

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

        Returns
        -------
        ndarray[bool]
        ÚfiucrÁ   )r   Útimedelta64r   Ú
datetime64ÚdateÚperiodT)Úconvert_non_numericÚdtype_if_all_natF©ÚskipnaÚstringÚmixedz"The behavior of 'isin' with dtype=z¼ and castable values (e.g. strings) is deprecated. In a future version, these will not be considered matching by isin. Explicitly cast to the appropriate dtype before calling isin instead.©Ú
stacklevelré   úDatetimeArray | TimedeltaArray)ry   rë   rÂ   Úzerosrï   r�   r^   rx   ró   rÄ   r   Úmaybe_convert_objectsrS   r  rð   r  rý   ÚwarningsÚwarnÚFutureWarningr>   r   r  r  r¥   rò   r´   )r~   rª   Ú	inferableÚinferredrq   rq   rr   rS   ì  sN   
ý

ÿø
þzDatetimeLikeArrayMixin.isinc                 C  ó   | j S ro   )Ú_isnanr�   rq   rq   rr   rN   A  s   zDatetimeLikeArrayMixin.isnac                 C  s
   | j tkS )z-
        return if each value is nan
        )r´   r   r�   rq   rq   rr   r3  D  ó   
zDatetimeLikeArrayMixin._isnanc                 C  s   t | j ¡ ƒS )zJ
        return if I have any nans; enables various perf speedups
        )r�   r3  Úanyr�   rq   rq   rr   Ú_hasnaK  s   zDatetimeLikeArrayMixin._hasnar‚   c                 C  s6   | j r|r
| |¡}|du rtj}t || j|¡ |S )az  
        Parameters
        ----------
        result : np.ndarray
        fill_value : object, default iNaT
        convert : str, dtype or None

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

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

        This is an internal routine.
        N)r6  rð   rÂ   ÚnanÚputmaskr3  )r~   r‚   Ú
fill_valuer¨   rq   rq   rr   Ú_maybe_mask_resultsR  s   
z*DatetimeLikeArrayMixin._maybe_mask_resultsú
str | Nonec                 C  s   | j du rdS | j jS )a{  
        Return the frequency object as a string if it's set, otherwise None.

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

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

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

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

        For PeriodIndex:

        >>> idx = pd.PeriodIndex(["2023-1", "2023-2", "2023-3"], freq="M")
        >>> idx.freqstr
        'M'
        N)rŽ   Úfreqstrr�   rq   rq   rr   r<  p  s   
zDatetimeLikeArrayMixin.freqstrc                 C  s0   | j dkrdS zt | ¡W S  ty   Y dS w )ax  
        Tries to return a string representing a frequency generated by infer_freq.

        Returns None if it can't autodetect the frequency.

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

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

        For TimedeltaIndex:

        >>> tdelta_idx = pd.to_timedelta(["0 days", "10 days", "20 days"])
        >>> tdelta_idx
        TimedeltaIndex(['0 days', '10 days', '20 days'],
                       dtype='timedelta64[ns]', freq=None)
        >>> tdelta_idx.inferred_freq
        '10D'
        r¬   N)r±   re   Ú
infer_freqrý   r�   rq   rq   rr   Úinferred_freqŽ  s   
ÿz$DatetimeLikeArrayMixin.inferred_freqúResolution | Nonec                 C  s4   | j }|d u r	d S zt |¡W S  ty   Y d S w ro   )r<  r   Úget_reso_from_freqstrÚKeyError)r~   r<  rq   rq   rr   Ú_resolution_obj­  s   ÿz&DatetimeLikeArrayMixin._resolution_objc                 C  s   | j jS )zO
        Returns day, hour, minute, second, millisecond or microsecond
        )rB  Úattrnamer�   rq   rq   rr   Ú
resolution·  s   z!DatetimeLikeArrayMixin.resolutionc                 C  ó   t j| jdd�d S )NT©Útimeliker   ©r   Úis_monotonicr´   r�   rq   rq   rr   Ú_is_monotonic_increasingÂ  ó   z/DatetimeLikeArrayMixin._is_monotonic_increasingc                 C  rE  )NTrF  r¬   rH  r�   rq   rq   rr   Ú_is_monotonic_decreasingÆ  rK  z/DatetimeLikeArrayMixin._is_monotonic_decreasingc                 C  s   t t| j d¡ƒƒ| jkS )NÚK)r³   rU   r´   rí   Úsizer�   rq   rq   rr   Ú
_is_uniqueÊ  s   z!DatetimeLikeArrayMixin._is_uniquec           
      C  s®  | j dkrt|dd ƒ| jkr||  ¡ | ¡ ƒ | j¡S z|  |¡}W n ty1   t| ||ƒ Y S w t|dd ƒ}t|ƒrKt	 
|t |  t¡¡|¡}|S |tu rh|tju r^tj| jtd�}|S tj| jtd�}|S t| jtƒs«tt| ƒ} | j|jkr«t|t| ƒƒs¡z
|j| jdd�}W n  ty    t |j ¡}t!| j"||ƒ Y S w |j"}t!| j"||ƒS |  #|¡}|| j" $d¡| $d¡ƒ}t%|ƒ}| j&|B }| '¡ rÕ|tju }	t (|||	¡ |S )Nr¬   rï   ry   rÁ   Fr	  rw   ))r±   rÿ   rï   rí   rî   r  r9   rc   rC   rR   Úcomp_method_OBJECT_ARRAYrÂ   rõ   rð   rÄ   r   ÚoperatorÚneÚonesr�   r+  rx   ry   rJ   r   ÚTimelikeOpsrì   ró   r  r  rý   r]   Úasm8r$   rŒ   r  rz   rN   r3  r5  r8  )
r~   r£   rp   ry   r‚   Ú	other_arrÚ
other_valsÚo_maskÚmaskÚ
nat_resultrq   rq   rr   Ú_cmp_methodÑ  sR   ÿÿ
ÿ
ÿþ


z"DatetimeLikeArrayMixin._cmp_methodÚ__pow__Ú__rpow__Ú__mul__Ú__rmul__Ú__truediv__Ú__rtruediv__Ú__floordiv__Ú__rfloordiv__Ú__mod__Ú__rmod__Ú
__divmod__Ú__rdivmod__ú@tuple[int | npt.NDArray[np.int64], None | npt.NDArray[np.bool_]]c                 C  sP   t |tƒr|j}d}||fS t |ttfƒr|j}d}||fS |j}|j}||fS )zN
        Get the int64 values and b_mask to pass to add_overflowsafe.
        N)rx   r   Úordinalr   r   r|   r3  r´   )r~   r£   Úi8valuesrY  rq   rq   rr   Ú_get_i8_values_and_mask  s   
ùþz.DatetimeLikeArrayMixin._get_i8_values_and_maskc                 C  s6   t | jtƒr	| jS t |¡sdS t | jtƒr| jS dS )zP
        Check if we can preserve self.freq in addition or subtraction.
        N)rx   ry   rJ   rŽ   r   rÎ   r   r¤   rq   rq   rr   Ú_get_arithmetic_result_freq*  s   
z2DatetimeLikeArrayMixin._get_arithmetic_result_freqc           
      C  s(  t  | jd¡stdt| ƒj› dt|ƒj› �ƒ‚td| ƒ} ddlm} ddl	m
} |tus.J ‚t|ƒrI| jt ¡  d| j› d	�¡ }|j||jd
�S t|ƒ}|  |¡\} }td| ƒ} |  |¡\}}t| jtj|dd
�ƒ}| d| j› d	�¡}||j| jd�}| d| j› d	�¡}|  |¡}	|j|||	d�S )Nræ   úcannot add ú and rl   r   ©rj   )Útz_to_dtypezM8[ú]rÁ   rw   ©rã   r  ©ry   rŽ   )r   Úis_np_dtypery   rò   ró   rô   r   Úpandas.core.arraysrj   Úpandas.core.arrays.datetimesrp  r   rN   rŒ   Úto_datetime64rð   r  Ú_simple_newr   Ú_ensure_matching_resosrk  r   r´   rÂ   rõ   rz   rã   rl  )
r~   r£   rj   rp  r‚   Úother_i8rX  Ú
res_valuesry   Únew_freqrq   rq   rr   Ú_add_datetimelike_scalar:  s*   ÿ


z/DatetimeLikeArrayMixin._add_datetimelike_scalarc                 C  s6   t  | jd¡stdt| ƒj› dt|ƒj› �ƒ‚||  S )Nræ   rm  rn  )r   rt  ry   rò   ró   rô   r¤   rq   rq   rr   Ú_add_datetime_arraylike\  s
   ÿz.DatetimeLikeArrayMixin._add_datetime_arraylikeúdatetime | np.datetime64c                 C  sZ   | j jdkrtdt| ƒj› �ƒ‚td| ƒ} t|ƒr| t S t|ƒ}|  	|¡\} }|  
|¡S )Nrá   ú"cannot subtract a datelike from a rj   )ry   rë   rò   ró   rô   r   rN   r   r   ry  Ú_sub_datetimelike)r~   r£   Útsrq   rq   rr   Ú_sub_datetimelike_scalarf  s   

z/DatetimeLikeArrayMixin._sub_datetimelike_scalarc                 C  sZ   | j jdkrtdt| ƒj› �ƒ‚t| ƒt|ƒkrtdƒ‚td| ƒ} |  |¡\} }|  	|¡S )Nrá   r€  ú$cannot add indices of unequal lengthrj   )
ry   rë   rò   ró   rô   r³   rý   r   ry  r�  r¤   rq   rq   rr   Ú_sub_datetime_arraylikey  s   

z.DatetimeLikeArrayMixin._sub_datetime_arraylikeúTimestamp | DatetimeArrayc           
   
   C  s¼   t d| ƒ} ddlm} z|  |¡ W n ty- } zt|ƒ dd¡}t|ƒ|ƒ|‚d }~ww |  |¡\}}t	| j
tj| dd�ƒ}| d| j› d	�¡}|  |¡}	t d
|	ƒ}	|j||j|	d�S )Nrj   r   ©rl   ÚcompareÚsubtractrw   rÁ   útimedelta64[rq  zTick | Noners  )r   ru  rl   Ú_assert_tzawareness_compatrò   rn   Úreplaceró   rk  r   r´   rÂ   rõ   rz   r  rl  rx  ry   )
r~   r£   rl   r   Únew_messagerz  rX  r{  Úres_m8r|  rq   rq   rr   r�  †  s   
€þ

z(DatetimeLikeArrayMixin._sub_datetimeliker   rk   c                 C  s\   t  | jd¡stdt| ƒj› �ƒ‚ddlm} t 	|j
| j¡}t|jƒ}|||d�}||  S )Nræ   zcannot add Period to a r   )rk   rÁ   )r   rt  ry   rò   ró   rô   Úpandas.core.arrays.periodrk   rÂ   Úbroadcast_tori  rï   rJ   rŽ   )r~   r£   rk   Úi8valsry   Úparrrq   rq   rr   Ú_add_periodš  s   
z"DatetimeLikeArrayMixin._add_periodc                 C  r–   ro   r—   )r~   Úoffsetrq   rq   rr   Ú_add_offset§  s   z"DatetimeLikeArrayMixin._add_offsetc                 C  sj   t |ƒr tj| jdd� | jj¡}| t¡ t	| ƒj
|| jd�S td| ƒ} t|ƒ}|  |¡\} }|  |¡S )zk
        Add a delta of a timedeltalike

        Returns
        -------
        Same type as self
        rw   rÁ   r*  )rN   rÂ   Úemptyrï   rz   rŒ   ry   Úfillr   ró   rx  r   r   ry  Ú_add_timedeltalike)r~   r£   Ú
new_valuesrq   rq   rr   Ú_add_timedeltalike_scalarª  s   


z0DatetimeLikeArrayMixin._add_timedeltalike_scalarc                 C  s:   t | ƒt |ƒkrtdƒ‚td| ƒ} |  |¡\} }|  |¡S )zl
        Add a delta of a TimedeltaIndex

        Returns
        -------
        Same type as self
        r„  r*  )r³   rý   r   ry  r˜  r¤   rq   rq   rr   Ú_add_timedelta_arraylike¾  s
   


z/DatetimeLikeArrayMixin._add_timedelta_arraylikeúTimedelta | TimedeltaArrayc                 C  s\   t d| ƒ} |  |¡\}}t| jtj|dd�ƒ}| | jj¡}|  	|¡}t
| ƒj|| j|d�S )Nr*  rw   rÁ   rs  )r   rk  r   r´   rÂ   rõ   rz   rŒ   ry   rl  ró   rx  )r~   r£   rz  rX  r™  r{  r|  rq   rq   rr   r˜  Ð  s   

ÿz)DatetimeLikeArrayMixin._add_timedeltalikec                 C  sv   t | jtƒrtdt| ƒj› dttƒj› �ƒ‚td| ƒ} tj	| j
tjd�}| t¡ | | jj¡}t| ƒj|| jdd�S )z$
        Add pd.NaT to self
        zCannot add rn  zTimedeltaArray | DatetimeArrayrÁ   Nrs  )rx   ry   rJ   rò   ró   rô   r   r   rÂ   r–  rï   rñ   r—  r   rz   rŒ   rx  ©r~   r‚   rq   rq   rr   Ú_add_natá  s   ÿ

ÿzDatetimeLikeArrayMixin._add_natc                 C  sP   t j| jt jd�}| t¡ | jjdv r#td| ƒ} | 	d| j
› d�¡S | 	d¡S )z+
        Subtract pd.NaT from self
        rÁ   ré   zDatetimeArray| TimedeltaArrayrŠ  rq  ztimedelta64[ns])rÂ   r–  rï   rñ   r—  r   ry   rë   r   rz   r  r�  rq   rq   rr   Ú_sub_natø  s   


zDatetimeLikeArrayMixin._sub_natúPeriod | PeriodArrayc                   s¤   t ˆ jtƒstdt|ƒj› dtˆ ƒj› �ƒ‚tdˆ ƒ‰ ˆ  |¡ ˆ  |¡\}}t	ˆ j
tj| dd�ƒ}t ‡ fdd„|D ƒ¡}|d u rGˆ j}nˆ j|B }t||< |S )Núcannot subtract ú from rk   rw   rÁ   c                   s   g | ]}ˆ j j| ‘qS rq   )rŽ   Úbase©r­   r¦   r�   rq   rr   Ú
<listcomp>  ó    z:DatetimeLikeArrayMixin._sub_periodlike.<locals>.<listcomp>)rx   ry   rJ   rò   ró   rô   r   r¥   rk  r   r´   rÂ   rõ   r]   r3  r   )r~   r£   rz  rX  Únew_i8_dataÚnew_datarY  rq   r�   rr   Ú_sub_periodlike  s   ÿ


z&DatetimeLikeArrayMixin._sub_periodlikec                 C  sŽ   |t jt jfv s
J ‚t|ƒdkr| jdkr|| |d ƒS tjdt| ƒj› d�t	t
ƒ d� | j|jks:J | j|jfƒ‚||  d¡t |¡ƒ}|S )aZ  
        Add or subtract array-like of DateOffset objects

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

        Returns
        -------
        np.ndarray[object]
            Except in fastpath case with length 1 where we operate on the
            contained scalar.
        r¬   r   z)Adding/subtracting object-dtype array to z not vectorized.r(  ÚO)rQ  ÚaddÚsubr³   r±   r-  r.  ró   rô   r:   r>   rï   rð   rÂ   rõ   )r~   r£   rp   r{  rq   rq   rr   Ú_addsub_object_array%  s   ÿüz+DatetimeLikeArrayMixin._addsub_object_arrayr$  Únamer%  c                K  sV   |dvrt d|› dt| ƒ› �ƒ‚tt|ƒ}||  ¡ fd|i|¤Ž}t| ƒj|| jd�S )N>   ÚcummaxÚcumminzAccumulation z not supported for r%  rÁ   )rò   ró   rÿ   rV   r”   rx  ry   )r~   r®  r%  r€   rp   r‚   rq   rq   rr   Ú_accumulateI  s
   
z"DatetimeLikeArrayMixin._accumulateÚ__add__c                 C  s   t |dd ƒ}t|ƒ}|tu r|  ¡ }n£t|tttjfƒr"|  	|¡}n”t|t
ƒr-|  |¡}n‰t|ttjfƒr;|  |¡}n{t|tƒrMt | jd¡rM|  |¡}nit |¡rmt| jtƒs\t| ƒ‚td| ƒ}| ||jj tj¡}nIt |d¡ry|  |¡}n=t|ƒr…|  |tj¡}n1t |d¡s�t|tƒr•|   |¡S t!|ƒr´t| jtƒs£t| ƒ‚td| ƒ}| ||jj tj¡}nt"S t|tj#ƒrÎt |jd¡rÎddl$m%} | &|¡S |S )Nry   ræ   rk   rá   r   r‡  )'rÿ   r^   r   rž  rx   r   r   rÂ   r  rš  r   r•  r   r  r}  r   r   rt  ry   r“  Ú
is_integerrJ   r&   r   Ú_addsub_int_array_or_scalarÚ_nrQ  r«  r›  rC   r­  rH   r~  rA   ÚNotImplementedÚndarrayru  rl   r  ©r~   r£   Úother_dtyper‚   Úobjrl   rq   rq   rr   r²  R  sF   



ÿ


zDatetimeLikeArrayMixin.__add__c                 C  s
   |   |¡S ro   )r²  r¤   rq   rq   rr   Ú__radd__Š  s   
zDatetimeLikeArrayMixin.__radd__Ú__sub__c                 C  s°  t |dd ƒ}t|ƒ}|tu r|  ¡ }n«t|tttjfƒr#|  	| ¡}n›t|t
ƒr/|  | ¡}n�t|ttjfƒr=|  |¡}n�t |¡r]t| jtƒsLt| ƒ‚td| ƒ}| ||jj tj¡}nat|tƒrh|  |¡}nVt |d¡ru|  | ¡}nIt|ƒr�|  |tj¡}n=t |d¡sŒt|tƒr’|   |¡}n,t|tƒr�|  |¡}n!t!|ƒr¼t| jtƒs«t| ƒ‚td| ƒ}| ||jj tj¡}nt"S t|tj#ƒrÖt |jd¡rÖddl$m%} | &|¡S |S )Nry   rk   ræ   rá   r   r‡  )'rÿ   r^   r   rŸ  rx   r   r   rÂ   r  rš  r   r•  r   r  rƒ  r   r³  ry   rJ   r&   r   r´  rµ  rQ  r¬  r   r©  rt  r›  rC   r­  rH   r…  rA   r¶  r·  ru  rl   r  r¸  rq   rq   rr   r¼  Ž  sJ   




ÿ


zDatetimeLikeArrayMixin.__sub__c                 C  s  t |dd ƒ}t |d¡pt|tƒ}|r9t | jd¡r9t |¡r%t|ƒ|  S t|tƒs5ddl	m
} | |¡}||  S | jjdkrVt|dƒrV|sVtdt| ƒj› dt|ƒj› �ƒ‚t| jtƒrpt |d¡rptdt| ƒj› d|j› �ƒ‚t | jd¡r�td| ƒ} |  | S | |  S )	Nry   rá   ræ   r   ro  r¡  r¢  rl   )rÿ   r   rt  rx   rH   ry   rÎ   r   r‡   ru  rj   r  rë   r  rò   ró   rô   rJ   r   )r~   r£   r¹  Úother_is_dt64rj   rq   rq   rr   Ú__rsub__Æ  s*   ÿ


ÿ


zDatetimeLikeArrayMixin.__rsub__c                 C  s4   | | }|d d … | d d …< t | jtƒs|j| _| S ro   ©rx   ry   rJ   rŽ   rÐ   ©r~   r£   r‚   rq   rq   rr   Ú__iadd__è  ó
   zDatetimeLikeArrayMixin.__iadd__c                 C  s4   | | }|d d … | d d …< t | jtƒs|j| _| S ro   r¿  rÀ  rq   rq   rr   Ú__isub__ñ  rÂ  zDatetimeLikeArrayMixin.__isub__Úqsúnpt.NDArray[np.float64]Úinterpolationc                   s   t ƒ j||d�S )N)rÄ  rÆ  )rÍ   Ú	_quantile)r~   rÄ  rÆ  rÑ   rq   rr   rÇ  ý  s   z DatetimeLikeArrayMixin._quantile©Úaxisr%  rÉ  úAxisInt | Nonec                K  ó8   t  d|¡ t  || j¡ tj| j||d�}|  ||¡S )a  
        Return the minimum value of the Array or minimum along
        an axis.

        See Also
        --------
        numpy.ndarray.min
        Index.min : Return the minimum value in an Index.
        Series.min : Return the minimum value in a Series.
        rq   rÈ  )ÚnvÚvalidate_minÚvalidate_minmax_axisr±   rQ   ÚnanminrŒ   Ú_wrap_reduction_result©r~   rÉ  r%  r€   r‚   rq   rq   rr   Úmin  ó   zDatetimeLikeArrayMixin.minc                K  rË  )a  
        Return the maximum value of the Array or maximum along
        an axis.

        See Also
        --------
        numpy.ndarray.max
        Index.max : Return the maximum value in an Index.
        Series.max : Return the maximum value in a Series.
        rq   rÈ  )rÌ  Úvalidate_maxrÎ  r±   rQ   ÚnanmaxrŒ   rÐ  rÑ  rq   rq   rr   Úmax  rÓ  zDatetimeLikeArrayMixin.maxr   )r%  rÉ  c                C  sF   t | jtƒrtdt| ƒj› d�ƒ‚tj| j|||  	¡ d�}|  
||¡S )aÝ  
        Return the mean value of the Array.

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

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

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

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

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

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

        For :class:`pandas.TimedeltaIndex`:

        >>> tdelta_idx = pd.to_timedelta([1, 2, 3], unit='D')
        >>> tdelta_idx
        TimedeltaIndex(['1 days', '2 days', '3 days'],
                        dtype='timedelta64[ns]', freq=None)
        >>> tdelta_idx.mean()
        Timedelta('2 days 00:00:00')
        zmean is not implemented for zX since the meaning is ambiguous.  An alternative is obj.to_timestamp(how='start').mean()©rÉ  r%  rY  )rx   ry   rJ   rò   ró   rô   rQ   ÚnanmeanrŒ   rN   rÐ  )r~   r%  rÉ  r‚   rq   rq   rr   Úmean)  s   ,ÿÿzDatetimeLikeArrayMixin.meanc                K  sH   t  d|¡ |d urt|ƒ| jkrtdƒ‚tj| j||d�}|  ||¡S )Nrq   z abs(axis) must be less than ndimrÈ  )	rÌ  Úvalidate_medianÚabsr±   rý   rQ   Ú	nanmedianrŒ   rÐ  rÑ  rq   rq   rr   Úmedianb  s
   zDatetimeLikeArrayMixin.medianÚdropnac                 C  sH   d }|r|   ¡ }tj|  d¡|d�}| | jj¡}ttj|ƒ}|  	|¡S )Nrw   )rY  )
rN   rO   Úmoderz   rŒ   ry   r   rÂ   r·  r}   )r~   rÞ  rY  Úi8modesÚnpmodesrq   rq   rr   Ú_model  s   
zDatetimeLikeArrayMixin._modeÚhowÚhas_dropped_naÚ	min_countÚintÚngroupsÚidsúnpt.NDArray[np.intp]c                K  s’  | j }|jdkr)|dv rtd|› d�ƒ‚|dv r(tjd|› d|› d�ttƒ d	� n2t|tƒrO|dv r:td
|› d�ƒ‚|dv rNtjd|› d|› d�ttƒ d	� n|dv r[td|› d�ƒ‚| j	 
d¡}ddlm}	 |	 |¡}
|	||
|d�}|j|f|||d dœ|¤Ž}|j|jv r‰|S |j dks�J ‚|dv r½ddlm} t| j tƒr¤tdƒ‚td| ƒ} d| j› d�}| 
|¡}|j||j d�S | 
| j	j ¡}|  |¡S )Nrá   )ÚsumÚprodÚcumsumÚcumprodÚvarÚskewz!datetime64 type does not support z operations)r5  Úallr  zh' with datetime64 dtypes is deprecated and will raise in a future version. Use (obj != pd.Timestamp(0)).z() instead.r(  zPeriod type does not support ze' with PeriodDtype is deprecated and will raise in a future version. Use (obj != pd.Period(0, freq)).)rë  rí  rï  rî  z"timedelta64 type does not support rv   r   )ÚWrappedCythonOp)rã  rë   rä  )rå  rç  Úcomp_idsrY  )ÚstdÚsemr‡  z-'std' and 'sem' are not valid for PeriodDtyper*  zm8[rq  rÁ   )ry   rë   rò   r-  r.  r/  r>   rx   rJ   rŒ   rz   Úpandas.core.groupby.opsrñ  Úget_kind_from_howÚ_cython_op_ndim_compatrã  Úcast_blocklistru  rl   r   r  rx  r}   )r~   rã  rä  rå  rç  rè  r€   ry   Únpvaluesrñ  rë   rp   r{  rl   Ú	new_dtyperq   rq   rr   Ú_groupby_opy  sl   

ÿü€
ÿü€
ÿûú	


z"DatetimeLikeArrayMixin._groupby_op©ru   r�   )NNF)ry   r“   r”   r�   ru   r•   )ru   rš   )rœ   rn   ru   r�   )rœ   r�   ru   r¡   )r£   r�   ru   r•   ©ru   r‹   )ru   rf   )ru   r¶   )r·   r¹   ru   rº   )F)r¼   r�   )NN)ry   r¿   r”   rÀ   ru   r‹   )rÆ   r1   ru   r�   )rÆ   rÊ   ru   r2   )rË   r/   ru   rÌ   )ru   r�   )rË   rÜ   rœ   rÝ   ru   r•   ©ru   r•   ©T)r”   r�   ©ru   r2   )ry   rù   ru   rj   )ry   rû   ru   rl   ).)ry   r“   ru   r'   ro   )r  r�   r  r�   )r  r�   ru   rn   )rü   r�   )ru   r  )rª   r'   ru   r  )ru   r  )r‚   r‹   ru   r‹   )ru   r;  )ru   r?  ©ru   rn   )ru   rh  )ru   rj   )r£   rj   ru   rj   )r£   r  ru   rl   )r£   rj   ru   rl   )r£   r†  ru   rl   )r£   r   ru   rk   )r£   rl   )r£   rœ  )r£   r   ru   rº   )r£   rº   )r®  rn   r%  r�   ru   r2   )rÄ  rÅ  rÆ  rn   ru   r2   )rÉ  rÊ  r%  r�   )r%  r�   rÉ  rÊ  )rÞ  r�   )
rã  rn   rä  r�   rå  ræ  rç  ræ  rè  ré  )`rô   Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r=   r‘   r™   Úpropertyr›   rŸ   r¢   r¥   r{   r«   rµ   r´   r»   r¾   rÅ   r   rÉ   rÏ   rÞ   rß   rð   rz   r  r  r  rþ   r  r   r  rY   r  rS   rN   r3  r6  r   r:  r<  r>  rB  rD  rJ  rL  rO  r[  rs   r\  r]  r^  r_  r`  ra  rb  rc  rd  re  rf  rg  rk  rl  r}  r~  rƒ  r…  r�  r“  r•  rš  r›  r˜  rž  rŸ  r©  r­  r±  rb   r²  r»  r¼  r¾  rÁ  rÃ  r†   rÇ  rÒ  rÖ  rÙ  rÝ  râ  rû  Ú__classcell__rq   rq   rÑ   rr   r‡   Ä   s  
 ÿ





ÿÿ3	(û=:Uÿ	
9!	

#	
7
7"	9	r‡   c                   @  s$   e Zd ZdZedd�ddd	„ƒZd
S )ÚDatelikeOpszK
    Common ops for DatetimeIndex/PeriodIndex, but not TimedeltaIndex.
    zNhttps://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior)ÚURLr¸   rn   ru   rº   c                 C  s   | j |tjd�}|jtdd�S )a°  
        Convert to Index using specified date_format.

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

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

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

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

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

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

        Examples
        --------
        >>> rng = pd.date_range(pd.Timestamp("2018-03-10 09:00"),
        ...                     periods=3, freq='s')
        >>> rng.strftime('%%B %%d, %%Y, %%r')
        Index(['March 10, 2018, 09:00:00 AM', 'March 10, 2018, 09:00:01 AM',
               'March 10, 2018, 09:00:02 AM'],
              dtype='object')
        )r¸   r·   Frç   )r»   rÂ   r7  rð   rÄ   )r~   r¸   r‚   rq   rq   rr   ÚstrftimeÎ  s   1zDatelikeOps.strftimeN)r¸   rn   ru   rº   )rô   r  r  r  r<   r
  rq   rq   rq   rr   r  É  s    ÿr  aO	  
    Perform {op} operation on the data to the specified `freq`.

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

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

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

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

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

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

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

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

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

    **Series**

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

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

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

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

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

    **Series**

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

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

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

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

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

    **Series**

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

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

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

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

    >>> rng_tz.ceil("h", ambiguous=True)
    DatetimeIndex(['2021-10-31 02:00:00+02:00'],
                  dtype='datetime64[ns, Europe/Amsterdam]', freq=None)
    c                      sÒ  e Zd ZU dZded< dejdfded
d„Zedd„ ƒZ	e
dd„ ƒZejdfdd„ƒZedgdd„ƒZeedhdd„ƒƒZedidd„ƒZedjdd „ƒZedkd"d#„ƒZdldmd'd(„Zd)d*„ Zdn‡ fd.d/„Zd0d1„ Zeee jd2d3�ƒ	4	4dodpd9d:„ƒZeee jd;d3�ƒ	4	4dodpd<d=„ƒZeee jd>d3�ƒ	4	4dodpd?d@„ƒZ dd$dAœdqdEdF„Z!dd$dAœdqdGdH„Z"dfdIdJ„Z#drdKdL„Z$ds‡ fdNdO„Z%	$	dtdu‡ fdRdS„Z&e	Tdvdw‡ fdXdY„ƒZ'dxdy‡ fd\d]„Z(dzdadb„Z)e
d{dcdd„ƒZ*‡  Z+S )|rT  zK
    Common ops for TimedeltaIndex/DatetimeIndex, but not PeriodIndex.
    znp.dtypeÚ_default_dtypeNFr”   r�   ru   r•   c           	      C  sš  t jt| ƒj› d�ttƒ d� |d urt|ƒ}t|dd�}t|t	ƒr)|j
dtd�}t|dd ƒ}|d u }|tjur:|nd }t|t| ƒƒrx|rFn|d u rN|j}n|r]|jr]t|ƒ}t||jƒ}|d urq||jkrqtd|› d	|j› �ƒ‚|j}|j}n'|d u rŸt|tjƒrŒ|jjd
v rŒ|j}n| j}t|tjƒrŸ|jdkrŸ| |¡}t|tjƒs¶tdt|ƒj› dt| ƒj› d�ƒ‚|jdvr¿tdƒ‚|jdkrõ|d u rÒ| j}| | j¡}n#t |d¡rÞ| |¡}nt|tƒrõ| jj}|› d|j› d�}| |¡}|  ||¡}|dk�rtdt| ƒj› d�ƒ‚|�r|  ¡ }|�r*t|ƒ}|jjdk�r*t|t!ƒ�s*tdƒ‚t"j#| ||d� || _$|d u �rI|d u�rKt| ƒ %| |¡ d S d S d S )NzV.__init__ is deprecated and will be removed in a future version. Use pd.array instead.r(  Tr  rñ   ©Úna_valuerÐ   údtype=z does not match data dtype ÚMmrw   zUnexpected type 'z'. 'values' must be a z6, ndarray, or Series or Index containing one of those.)r¬   é   z.Only 1-dimensional input arrays are supported.ré   ú8[rq  Úinferz#Frequency inference not allowed in z$.__init__. Use 'pd.array()' instead.ræ   ú(TimedeltaArray/Index freq must be a Tick)rª   ry   )&r-  r.  ró   rô   r/  r>   rE   r_   rx   r\   r  r   rÿ   r   Ú
no_defaultrŽ   r!   Ú_validate_inferred_freqry   rò   rŒ   rÂ   r·  rë   r  rz   rý   r±   rt  rH   r  Ú_validate_dtyper”   r   r   r™   rÐ   Ú_validate_frequency)	r~   rª   ry   rŽ   r”   r>  Úexplicit_nonerë   rú  rq   rq   rr   r™   ›  s†   û

ÿ
ÿÿ




ÿÿzTimelikeOps.__init__c                 C  r–   ro   r—   )Úclsrª   ry   rq   rq   rr   r  ÷  s   zTimelikeOps._validate_dtypec                 C  r2  )zK
        Return the frequency object if it is set, otherwise None.
        ©rÐ   r�   rq   rq   rr   rŽ   û  s   zTimelikeOps.freqc                 C  sV   |d ur&t |ƒ}|  | |¡ | jjdkrt|tƒstdƒ‚| jdkr&tdƒ‚|| _	d S )Nræ   r  r¬   zCannot set freq with ndim > 1)
r!   r  ry   rë   rx   r   rò   r±   rý   rÐ   rž   rq   rq   rr   rŽ     s   

Úvalidate_kwdsÚdictc                 C  s’   |du r	d| _ dS |dkr| j du rt| jƒ| _ dS dS |tju r#dS | j du r=t|ƒ}t| ƒj| |fi |¤Ž || _ dS t|ƒ}t|| j ƒ dS )zº
        Constructor helper to pin the appropriate `freq` attribute.  Assumes
        that self._freq is currently set to any freq inferred in
        _from_sequence_not_strict.
        Nr  )rÐ   r!   r>  r   r  ró   r  r  )r~   rŽ   r  rq   rq   rr   Ú_maybe_pin_freq  s   

ý


zTimelikeOps._maybe_pin_freqrŽ   r   c              
   K  s    |j }|jdks||jkrdS z | jd|d dt|ƒ||jdœ|¤Ž}t |j|j¡s-t	‚W dS  t	yO } zdt
|ƒv r?|‚t	d|› d|j› �ƒ|‚d}~ww )am  
        Validate that a frequency is compatible with the values of a given
        Datetime Array/Index or Timedelta Array/Index

        Parameters
        ----------
        index : DatetimeIndex or TimedeltaIndex
            The index on which to determine if the given frequency is valid
        freq : DateOffset
            The frequency to validate
        r   N)ÚstartÚendÚperiodsrŽ   r  z	non-fixedúInferred frequency ú9 from passed values does not conform to passed frequency rq   )r>  rN  r<  Ú_generate_ranger³   r  rÂ   Úarray_equalr´   rý   rn   )r  ÚindexrŽ   r€   r1  Úon_freqr   rq   rq   rr   r  0  s8   ûúÿÿÿý€özTimelikeOps._validate_frequencyr   ú
int | Noner2   c                 O  r–   ro   r—   )r  r  r  r   rŽ   r   r€   rq   rq   rr   r#  \  r§   zTimelikeOps._generate_rangeræ  c                 C  s   t | jjƒS ro   )r   rŒ   ry   r�   rq   rq   rr   rì   d  s   zTimelikeOps._cresorn   c                 C  s
   t | jƒS ro   )Údtype_to_unitry   r�   rq   rq   rr   r  h  r4  zTimelikeOps.unitTr  r
  c                 C  s~   |dvrt dƒ‚t | jj› d|› d�¡}t| j||d�}t| jtjƒr(|j}ntd| ƒj}t	||d�}t
| ƒj||| jd�S )	N)ÚsÚmsÚusÚnsz)Supported units are 's', 'ms', 'us', 'ns'r  rq  r	  rj   rr  rs  )rý   rÂ   ry   rë   r   rŒ   rx   r   rã   rH   ró   rx  rŽ   )r~   r  r
  ry   r™  rú  rã   rq   rq   rr   r  o  s   ÿzTimelikeOps.as_unitc                 C  s@   | j |j kr| j |j k r|  |j¡} | |fS | | j¡}| |fS ro   )rì   r  r  r¤   rq   rq   rr   ry  „  s   ÿz"TimelikeOps._ensure_matching_resosÚufuncúnp.ufuncÚmethodc                   s`   |t jt jt jfv r"t|ƒdkr"|d | u r"t||ƒ| jfi |¤ŽS tƒ j||g|¢R i |¤ŽS )Nr¬   r   )	rÂ   ÚisnanÚisinfÚisfiniter³   rÿ   rŒ   rÍ   Ú__array_ufunc__)r~   r-  r/  Úinputsr€   rÑ   rq   rr   r3  �  s
   zTimelikeOps.__array_ufunc__c           
      C  s¬   t | jtƒr!td| ƒ} |  d ¡}| ||||¡}|j| j||d�S |  d¡}ttj	|ƒ}t
|| jƒ}|dkr:|  ¡ S t|||ƒ}	| j|	td�}| | jj¡}| j|| jd�S )Nrj   )Ú	ambiguousÚnonexistentrw   r   ©r9  rÁ   )rx   ry   rH   r   Útz_localizeÚ_roundrã   rz   rÂ   r·  r%   rì   r”   r#   r:  r   rŒ   rx  )
r~   rŽ   rß  r5  r6  Únaiver‚   rª   ÚnanosÚ	result_i8rq   rq   rr   r9  š  s    

ÿ
zTimelikeOps._roundÚround)rp   Úraiser5  r4   r6  r5   c                 C  ó   |   |tj||¡S ro   )r9  r"   ÚNEAREST_HALF_EVEN©r~   rŽ   r5  r6  rq   rq   rr   r=  °  ó   zTimelikeOps.roundÚfloorc                 C  r?  ro   )r9  r"   ÚMINUS_INFTYrA  rq   rq   rr   rC  ¹  rB  zTimelikeOps.floorÚceilc                 C  r?  ro   )r9  r"   Ú
PLUS_INFTYrA  rq   rq   rr   rE  Â  rB  zTimelikeOps.ceilrÈ  rÉ  rÊ  r%  c                C  ó   t j| j|||  ¡ d�S ©Nr×  )rQ   ÚnananyrŒ   rN   ©r~   rÉ  r%  rq   rq   rr   r5  Î  s   zTimelikeOps.anyc                C  rG  rH  )rQ   ÚnanallrŒ   rN   rJ  rq   rq   rr   rð  Ò  s   zTimelikeOps.allc                 C  s
   d | _ d S ro   r  r�   rq   rq   rr   rß   Ú  s   
zTimelikeOps._maybe_clear_freqc                 C  sh   |du rn&t | ƒdkr t|tƒr | jjdkrt|tƒstdƒ‚n|dks&J ‚t| jƒ}|  	¡ }||_
|S )z×
        Helper to get a view on the same data, with a new freq.

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

        Returns
        -------
        Same type as self
        Nr   ræ   r  r  )r³   rx   r   ry   rë   r   rò   r!   r>  rz   rÐ   )r~   rŽ   r�   rq   rq   rr   Ú
_with_freqÝ  s   €
zTimelikeOps._with_freqr‹   c                   s   t | jtjƒr
| jS tƒ  ¡ S ro   )rx   ry   rÂ   rŒ   rÍ   Ú_values_for_jsonr�   rÑ   rq   rr   rM  ý  s   
zTimelikeOps._values_for_jsonÚuse_na_sentinelÚsortc                   s‚   | j d ur-tjt| ƒtjd�}|  ¡ }|r)| j jdk r)|d d d… }|d d d… }||fS |r:tdt| ƒj	› d�ƒ‚t
ƒ j|d�S )NrÁ   r   éÿÿÿÿzThe 'sort' keyword in zu.factorize is ignored unless arr.freq is not None. To factorize with sort, call pd.factorize(obj, sort=True) instead.)rN  )rŽ   rÂ   Úaranger³   Úintpr”   r®   ÚNotImplementedErrorró   rô   rÍ   Ú	factorize)r~   rN  rO  ÚcodesÚuniquesrÑ   rq   rr   rT  	  s   
ÿzTimelikeOps.factorizer   Ú	to_concatúSequence[Self]r(   c                   sŒ   t ƒ  ||¡}|d ‰ |dkrDdd„ |D ƒ}ˆ jd urDt‡ fdd„|D ƒƒrDt|d d… |dd … ƒ}t‡ fdd„|D ƒƒrDˆ j}||_|S )	Nr   c                 S  s   g | ]}t |ƒr|‘qS rq   )r³   r¤  rq   rq   rr   r¥  (	  r¦  z1TimelikeOps._concat_same_type.<locals>.<listcomp>c                 3  s   � | ]	}|j ˆ j kV  qd S ro   ©rŽ   r¤  ©rº  rq   rr   r¯   *	  s   € z0TimelikeOps._concat_same_type.<locals>.<genexpr>rP  r¬   c                 3  s.   � | ]}|d  d ˆ j  |d d  kV  qdS )r   rP  r¬   NrY  )r­   ÚpairrZ  rq   rr   r¯   ,	  s   €, )rÍ   Ú_concat_same_typerŽ   rð  ÚziprÐ   )r  rW  rÉ  Únew_objÚpairsr|  rÑ   rZ  rr   r\  	  s    zTimelikeOps._concat_same_typeÚCÚorderc                   s   t ƒ j|d�}| j|_|S )N)ra  )rÍ   r”   rŽ   rÐ   )r~   ra  r^  rÑ   rq   rr   r”   1	  s   zTimelikeOps.copyr-   r%  ri   c          
   	   K  s^   |dkrt ‚|s| j}	n| j ¡ }	tj|	f||||||dœ|¤Ž |s%| S t| ƒj|	| jd�S )z2
        See NDFrame.interpolate.__doc__.
        Úlinear)r/  rÉ  r%  ÚlimitÚlimit_directionÚ
limit_arearÁ   )rS  rŒ   r”   rP   Úinterpolate_2d_inplaceró   rx  ry   )
r~   r/  rÉ  r%  rc  rd  re  r”   r€   Úout_datarq   rq   rr   Úinterpolate6	  s(   
ÿùø
zTimelikeOps.interpolatec                 C  sP   t  | j¡sdS | j}|tk}t| jƒ}t|ƒ}t ||| dk¡ 	¡ dk}|S )zÓ
        Check if we are round times at midnight (and no timezone), which will
        be given a more compact __repr__ than other cases. For TimedeltaArray
        we are checking for multiples of 24H.
        Fr   )
r   rt  ry   r´   r   r   r    rÂ   Úlogical_andrê  )r~   Ú
values_intÚconsider_valuesrå   ÚppdÚ	even_daysrq   rq   rr   Ú_is_dates_only_	  s   
zTimelikeOps._is_dates_only)r”   r�   ru   r•   rþ  )r  r  )rŽ   r   )r   r'  ru   r2   )ru   ræ  r  rÿ  )r  rn   r
  r�   ru   r2   )r-  r.  r/  rn   )r>  r>  )r5  r4   r6  r5   ru   r2   )rÉ  rÊ  r%  r�   ru   r�   r   rý  )TF)rN  r�   rO  r�   )r   )rW  rX  rÉ  r(   ru   r2   )r`  )ra  rn   ru   r2   )
r/  r-   rÉ  ræ  r%  ri   r”   r�   ru   r2   rü  ),rô   r  r  r  r  r   r  r™   Úclassmethodr  r  rŽ   Úsetterr   r  r  r#  r=   rì   r  r  ry  r3  r9  r;   Ú
_round_docÚ_round_exampler½   r=  Ú_floor_examplerC  Ú_ceil_examplerE  r5  rð  rß   rL  rM  rT  r\  r”   rh  rn  r  rq   rq   rÑ   rr   rT  ”  sj   
 ÿ\

 *üüü

 ýý
)rT  r”   r�   Úcls_nameútuple[ArrayLike, bool]c                 C  s  t | dƒst| ttfƒst | ¡dkrt| ƒ} t| ƒ} d}nt| tƒr+td|› d�ƒ‚t	| dd�} t| t
ƒsAt| tƒrN| jjdv rN| jd	td
�} d}| |fS t| tƒra|  ¡ } |  ¡ } d}| |fS t| tjtfƒsrt | ¡} | |fS t| tƒrƒ| jj| jtd�j} d}| |fS )Nry   r   FzCannot create a z from a MultiIndex.Tr  rè   rñ   r  r7  )r  rx   rÃ   ÚtuplerÂ   r±   r?   rL   rò   r_   r\   rZ   ry   rë   r  r   Ú_maybe_convert_datelike_arrayr·  r[   rõ   rK   r  ÚtakerU  r   Ú_values)r˜   r”   ru  rq   rq   rr   Ú!ensure_arraylike_for_datetimelikey	  s6   


ÿ
ñõ
	
ùr{  r   r•   c                 C  rÇ   ro   rq   ©r   rq   rq   rr   Úvalidate_periods 	  r’   r}  úint | floatræ  c                 C  rÇ   ro   rq   r|  rq   rq   rr   r}  ¥	  r’   úint | float | Noner'  c                 C  sL   | dur$t  | ¡rtjdttƒ d� t| ƒ} | S t  | ¡s$td| › �ƒ‚| S )a9  
    If a `periods` argument is passed to the Datetime/Timedelta Array/Index
    constructor, cast it to an integer.

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

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

    Raises
    ------
    TypeError
        if periods is None, float, or int
    Nz•Non-integer 'periods' in pd.date_range, pd.timedelta_range, pd.period_range, and pd.interval_range are deprecated and will raise in a future version.r(  zperiods must be a number, got )	r   Úis_floatr-  r.  r/  r>   ræ  r³  rò   r|  rq   rq   rr   r}  ª	  s   
ú
þrŽ   r�   r>  c                 C  s>   |dur| dur| |krt d|› d| j› �ƒ‚| du r|} | S )a
  
    If the user passes a freq and another freq is inferred from passed data,
    require that they match.

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

    Returns
    -------
    freq : DateOffset or None
    Nr!  r"  )rý   r<  )rŽ   r>  rq   rq   rr   r  Ì	  s   þÿr  ry   ú'DatetimeTZDtype | np.dtype | ArrowDtypec                 C  sJ   t | tƒr| jS t | tƒr| jdvrtd| ›d�ƒ‚| jjS t | ¡d S )zç
    Return the unit str corresponding to the dtype's resolution.

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

    Returns
    -------
    str
    ré   r  z does not have a resolution.r   )	rx   rH   r  rF   rë   rý   Úpyarrow_dtyperÂ   Údatetime_datarÁ   rq   rq   rr   r(  é	  s   


r(  )rm   rn   )rt   r,   ru   r,   )r”   r�   ru  rn   ru   rv  )r   r•   ru   r•   )r   r~  ru   ræ  )r   r  ru   r'  )rŽ   r�   r>  r�   ru   r�   )ry   r�  ru   rn   )¦Ú
__future__r   r   r   Ú	functoolsr   rQ  Útypingr   r   r   r	   r
   r   r   r   r-  ÚnumpyrÂ   Úpandas._libsr   r   Úpandas._libs.arraysr   Úpandas._libs.tslibsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r    r!   Úpandas._libs.tslibs.fieldsr"   r#   Úpandas._libs.tslibs.np_datetimer$   Úpandas._libs.tslibs.timedeltasr%   Úpandas._libs.tslibs.timestampsr&   Úpandas._typingr'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   Úpandas.compat.numpyr7   rÌ  Úpandas.errorsr8   r9   r:   Úpandas.util._decoratorsr;   r<   r=   Úpandas.util._exceptionsr>   Úpandas.core.dtypes.castr?   Úpandas.core.dtypes.commonr@   rA   rB   rC   rD   rE   Úpandas.core.dtypes.dtypesrF   rG   rH   rI   rJ   Úpandas.core.dtypes.genericrK   rL   Úpandas.core.dtypes.missingrM   rN   Úpandas.corerO   rP   rQ   rR   Úpandas.core.algorithmsrS   rT   rU   Úpandas.core.array_algosrV   Úpandas.core.arraylikerW   Úpandas.core.arrays._mixinsrX   rY   Úpandas.core.arrays.arrow.arrayrZ   Úpandas.core.arrays.baser[   Úpandas.core.arrays.integerr\   Úpandas.core.commonÚcoreÚcommonrÖ   Úpandas.core.constructionr]   r  r^   r_   Úpandas.core.indexersr`   ra   Úpandas.core.ops.commonrb   Úpandas.core.ops.invalidrc   rd   Úpandas.tseriesre   Úcollections.abcrf   rg   r  ri   ru  rj   rk   rl   r�   rs   r†   r‡   r  rq  rr  rs  rt  rT  r{  r}  r  r(  rq   rq   rq   rr   Ú<module>   sš    (
LH 


ÿ            :?   
h'

"