Sindbad~EG File Manager

Current Path : /usr/local/lib/python3.12/site-packages/pandas/core/indexes/__pycache__/
Upload File :
Current File : //usr/local/lib/python3.12/site-packages/pandas/core/indexes/__pycache__/timedeltas.cpython-312.pyc

�

Mٜg�*��h�dZddlmZddlmZddlZddlmZm	Z	ddl
mZmZm
Z
ddlmZddlmZdd	lmZmZdd
lmZddlmZddlmcmZddlmZmZdd
l m!Z!ddl"m#Z#erddl$m%Z%e#gd�ejLzed��e#gd�e�Gd�de!���Z'						ddd�					dd�Z(y)z implement the TimedeltaIndex �)�annotations)�
TYPE_CHECKINGN)�index�lib)�
Resolution�	Timedelta�	to_offset)�disallow_ambiguous_unit)�find_stack_level)�	is_scalar�pandas_dtype)�	ABCSeries)�TimedeltaArray)�Index�maybe_extract_name)�DatetimeTimedeltaMixin)�
inherit_names)�DtypeObj)�__neg__�__pos__�__abs__�
total_seconds�round�floor�ceilT)�wrap)�
components�to_pytimedelta�sum�std�medianc���eZdZUdZdZeZedd��Zde	d<e
jZedd��Zde
je
je
jdddf	dd	�Zdd
�Zd�Zdd�Zdd
�Zedd��Zy)�TimedeltaIndexal
    Immutable Index of timedelta64 data.

    Represented internally as int64, and scalars returned Timedelta objects.

    Parameters
    ----------
    data : array-like (1-dimensional), optional
        Optional timedelta-like data to construct index with.
    unit : {'D', 'h', 'm', 's', 'ms', 'us', 'ns'}, optional
        The unit of ``data``.

        .. deprecated:: 2.2.0
         Use ``pd.to_timedelta`` instead.

    freq : str or pandas offset object, optional
        One of pandas date offset strings or corresponding objects. The string
        ``'infer'`` can be passed in order to set the frequency of the index as
        the inferred frequency upon creation.
    dtype : numpy.dtype or str, default None
        Valid ``numpy`` dtypes are ``timedelta64[ns]``, ``timedelta64[us]``,
        ``timedelta64[ms]``, and ``timedelta64[s]``.
    copy : bool
        Make a copy of input array.
    name : object
        Name to be stored in the index.

    Attributes
    ----------
    days
    seconds
    microseconds
    nanoseconds
    components
    inferred_freq

    Methods
    -------
    to_pytimedelta
    to_series
    round
    floor
    ceil
    to_frame
    mean

    See Also
    --------
    Index : The base pandas Index type.
    Timedelta : Represents a duration between two dates or times.
    DatetimeIndex : Index of datetime64 data.
    PeriodIndex : Index of Period data.
    timedelta_range : Create a fixed-frequency TimedeltaIndex.

    Notes
    -----
    To learn more about the frequency strings, please see `this link
    <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.

    Examples
    --------
    >>> pd.TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'])
    TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'],
                   dtype='timedelta64[ns]', freq=None)

    We can also let pandas infer the frequency when possible.

    >>> pd.TimedeltaIndex(np.arange(5) * 24 * 3600 * 1e9, freq='infer')
    TimedeltaIndex(['0 days', '1 days', '2 days', '3 days', '4 days'],
                   dtype='timedelta64[ns]', freq='D')
    �timedeltaindexc�"�tjS�N)�libindex�TimedeltaEngine��selfs �I/usr/local/lib/python3.12/site-packages/pandas/core/indexes/timedeltas.py�_engine_typezTimedeltaIndex._engine_type�s���'�'�'�r�_datac�.�|jjSr&)r.�_resolution_objr)s r+r0zTimedeltaIndex._resolution_obj�s���z�z�)�)�)r-NFc��|tjur2tjd|j�d�t
t
���|tjur3tjd|j�d�t
t
���nd}t|||�}t|�r|j|�t|�|�t|�}t|t�rH|tjur6|�||jk(r%|r|j�}|j!||��St|t"�rG|tjur5|�3|�||jk(r"|r|j�S|j%�Stj&|||||��}d}	|s"t|t(t*f�r|j,}	|j!|||	��S)	NzThe 'closed' keyword in zD construction is deprecated and will be removed in a future version.)�
stacklevelzThe 'unit' keyword in za construction is deprecated and will be removed in a future version. Use pd.to_timedelta instead.��name)�freq�unit�dtype�copy)r4�refs)r�
no_default�warnings�warn�__name__�
FutureWarningrrr�_raise_scalar_data_errorr
r
�
isinstancerr7r8�_simple_newr#�_view�_from_sequence_not_strictrr�_references)
�cls�datar6r5�closedr7r8r4�tdarrr9s
          r+�__new__zTimedeltaIndex.__new__�s�������'��M�M�*�3�<�<�.�9F�F��+�-�	
��s�~�~�%��M�M�(�����7/�/��+�-�
��D�!�$��c�2���T�?��(�(��.���%��� ��'�E�
�t�^�,�����&���%�4�:�:�"5���y�y�{���?�?�4�d�?�3�3�
�t�^�,�����&�����%�4�:�:�"5���y�y�{�"��z�z�|�#��8�8��t�$�e�$�
�����
�4�)�U�);�<��#�#�D����u�4�d��;�;r-c�.�tj|d�S)zF
        Can we compare values of the given dtype to our own?
        �m)r�is_np_dtype)r*r7s  r+�_is_comparable_dtypez#TimedeltaIndex._is_comparable_dtype�s�����u�c�*�*r-c���|j|�	|jj|d��}tj||�S#t$r}t	|�|�d}~wwxYw)z�
        Get integer location for requested label

        Returns
        -------
        loc : int, slice, or ndarray[int]
        F)�unboxN)�_check_indexing_errorr.�_validate_scalar�	TypeError�KeyErrorr�get_loc)r*�key�errs   r+rTzTimedeltaIndex.get_loc�sa��	
�"�"�3�'�	)��*�*�-�-�c��-�?�C��}�}�T�3�'�'���	)��3�-�S�(��	)�s�A�	A �A�A c� �t|�}|dfSr&)r)r*�label�parseds   r+�_parse_with_resozTimedeltaIndex._parse_with_reso�s���5�!���t�|�r-c��|j|j�}|t|j�ztdd�z
}||fS)N��ns)r�resolution_stringr	r)r*�resorY�lbound�rbounds     r+�_parsed_string_to_boundsz'TimedeltaIndex._parsed_string_to_bounds�sA�����f�6�6�7���)�F�$<�$<�=�=�	�!�T�@R�R���v�~�r-c��y)N�timedelta64�r)s r+�
inferred_typezTimedeltaIndex.inferred_types��r-)�returnztype[libindex.TimedeltaEngine])rgzResolution | None)r8�bool)r7rrgrh)rX�str)rYr)rgri)r=�
__module__�__qualname__�__doc__�_typr�	_data_cls�propertyr,�__annotations__r�_get_string_slicer0rr:rIrMrTrZrbrfrer-r+r#r#&s���"F�P�D��I�
�(��(����/�/���*��*��
�^�^�
�^�^��~�~���
�E<��E<�R+�(�"�
����r-r#)r6c��|�tj|||�rd}t|�}tj||||||��}t
j
||��S)a$
    Return a fixed frequency TimedeltaIndex with day as the default.

    Parameters
    ----------
    start : str or timedelta-like, default None
        Left bound for generating timedeltas.
    end : str or timedelta-like, default None
        Right bound for generating timedeltas.
    periods : int, default None
        Number of periods to generate.
    freq : str, Timedelta, datetime.timedelta, or DateOffset, default 'D'
        Frequency strings can have multiples, e.g. '5h'.
    name : str, default None
        Name of the resulting TimedeltaIndex.
    closed : str, default None
        Make the interval closed with respect to the given frequency to
        the 'left', 'right', or both sides (None).
    unit : str, default None
        Specify the desired resolution of the result.

        .. versionadded:: 2.0.0

    Returns
    -------
    TimedeltaIndex

    Notes
    -----
    Of the four parameters ``start``, ``end``, ``periods``, and ``freq``,
    exactly three must be specified. If ``freq`` is omitted, the resulting
    ``TimedeltaIndex`` will have ``periods`` linearly spaced elements between
    ``start`` and ``end`` (closed on both sides).

    To learn more about the frequency strings, please see `this link
    <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`__.

    Examples
    --------
    >>> pd.timedelta_range(start='1 day', periods=4)
    TimedeltaIndex(['1 days', '2 days', '3 days', '4 days'],
                   dtype='timedelta64[ns]', freq='D')

    The ``closed`` parameter specifies which endpoint is included.  The default
    behavior is to include both endpoints.

    >>> pd.timedelta_range(start='1 day', periods=4, closed='right')
    TimedeltaIndex(['2 days', '3 days', '4 days'],
                   dtype='timedelta64[ns]', freq='D')

    The ``freq`` parameter specifies the frequency of the TimedeltaIndex.
    Only fixed frequencies can be passed, non-fixed frequencies such as
    'M' (month end) will raise.

    >>> pd.timedelta_range(start='1 day', end='2 days', freq='6h')
    TimedeltaIndex(['1 days 00:00:00', '1 days 06:00:00', '1 days 12:00:00',
                    '1 days 18:00:00', '2 days 00:00:00'],
                   dtype='timedelta64[ns]', freq='6h')

    Specify ``start``, ``end``, and ``periods``; the frequency is generated
    automatically (linearly spaced).

    >>> pd.timedelta_range(start='1 day', end='5 days', periods=4)
    TimedeltaIndex(['1 days 00:00:00', '2 days 08:00:00', '3 days 16:00:00',
                    '5 days 00:00:00'],
                   dtype='timedelta64[ns]', freq=None)

    **Specify a unit**

    >>> pd.timedelta_range("1 Day", periods=3, freq="100000D", unit="s")
    TimedeltaIndex(['1 days', '100001 days', '200001 days'],
                   dtype='timedelta64[s]', freq='100000D')
    �D)rGr6r3)�com�any_noner	r�_generate_ranger#rA)�start�end�periodsr5r4rGr6rHs        r+�timedelta_rangerz
s\��f�|����W�e�S�9����T�?�D��*�*�
�s�G�T�&�t�
�E��%�%�e�$�%�7�7r-)NNNNNN)ryz
int | Noner6z
str | Nonergr#))rl�
__future__r�typingrr;�pandas._libsrr'r�pandas._libs.tslibsrrr	�pandas._libs.tslibs.timedeltasr
�pandas.util._exceptionsr�pandas.core.dtypes.commonrr
�pandas.core.dtypes.genericr�pandas.core.arrays.timedeltasr�pandas.core.common�core�commonrt�pandas.core.indexes.baserr� pandas.core.indexes.datetimeliker�pandas.core.indexes.extensionr�pandas._typingr�
_field_opsr#rzrer-r+�<module>r�s���$�"� �����
C�4��1�8� � ��D�7��'��P���� ��	
�	����	�Q�+�Q�	�
� Q�j���	
�	
��
Z8��Z8��Z8��Z8��Z8r-

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists