Sindbad~EG File Manager

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

�

Mٜg�����UddlmZddlZddlmZmZddlZddlmZmZm	Z	m
Z
ddlZddlZ
ddlmZddlmZmZmZmZddlmZddlmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$dd	l%m&Z'dd
l(m)Z)ddl*m+Z+ddl,m-Z-m.Z.dd
l/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7ddl8m9Z9m:Z:ddl;m<Z<m=Z=m>Z>m?Z?ddl@mAZAmBZBmCZCddlDmEZEmFZFmGZGmHZIddlJmKZKddlLmMZMmNZNddlOmPZPddlQmRZRddlSmTcmUZVddlWmXZYmZZZm[Z[ddl\m]Z]ddl^m_Z_m`Z`erddlambZbmcZcddldmeZemfZfe	e#e
j�fZhe	eeifZjiZkdeld<dddd �Zmd!ekd"<e+ekd"dd#dddej�d$�d%�z�Gd&�deeM��Zod(d'�Zpy))�)�annotationsN)�le�lt)�
TYPE_CHECKING�Literal�Union�overload)�lib)�VALID_CLOSED�Interval�
IntervalMixin�intervals_to_interval_bounds)�NA)
�	ArrayLike�AxisInt�Dtype�
FillnaOptions�IntervalClosedType�NpDtype�PositionalIndexer�
ScalarIndexer�Self�SequenceIndexer�SortKind�
TimeArrayLike�npt)�function)�IntCastingNaNError)�Appender)�LossySetitemError�maybe_upcast_numeric_to_64bit)�is_float_dtype�is_integer_dtype�is_list_like�is_object_dtype�	is_scalar�is_string_dtype�needs_i8_conversion�pandas_dtype)�CategoricalDtype�
IntervalDtype)�ABCDataFrame�ABCDatetimeIndex�ABCIntervalIndex�ABCPeriodIndex)�is_valid_na_for_dtype�isna�notna)�isin�take�unique�value_counts_internal)�ArrowExtensionArray)�ExtensionArray�_extension_array_shared_docs)�
DatetimeArray)�TimedeltaArray)�array�ensure_wrapped_if_datetimelike�
extract_array)�check_array_indexer)�invalid_comparison�unpack_zerodim_and_defer)�Iterator�Sequence)�Index�Serieszdict[str, str]�_interval_shared_docs�
IntervalArrayzarrays.IntervalArray�)�klass�qualname�namea�
%(summary)s

Parameters
----------
data : array-like (1-dimensional)
    Array-like (ndarray, :class:`DateTimeArray`, :class:`TimeDeltaArray`) containing
    Interval objects from which to build the %(klass)s.
closed : {'left', 'right', 'both', 'neither'}, default 'right'
    Whether the intervals are closed on the left-side, right-side, both or
    neither.
dtype : dtype or None, default None
    If None, dtype will be inferred.
copy : bool, default False
    Copy the input data.
%(name)sverify_integrity : bool, default True
    Verify that the %(klass)s is valid.

Attributes
----------
left
right
closed
mid
length
is_empty
is_non_overlapping_monotonic
%(extra_attributes)s
Methods
-------
from_arrays
from_tuples
from_breaks
contains
overlaps
set_closed
to_tuples
%(extra_methods)s
See Also
--------
Index : The base pandas Index type.
Interval : A bounded slice-like interval; the elements of an %(klass)s.
interval_range : Function to create a fixed frequency IntervalIndex.
cut : Bin values into discrete Intervals.
qcut : Bin values into equal-sized Intervals based on rank or sample quantiles.

Notes
-----
See the `user guide
<https://pandas.pydata.org/pandas-docs/stable/user_guide/advanced.html#intervalindex>`__
for more.

%(examples)s�classz@Pandas array for interval data that are closed on the same side.a�    Examples
    --------
    A new ``IntervalArray`` can be constructed directly from an array-like of
    ``Interval`` objects:

    >>> pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
    <IntervalArray>
    [(0, 1], (1, 5]]
    Length: 2, dtype: interval[int64, right]

    It may also be constructed using one of the constructor
    methods: :meth:`IntervalArray.from_arrays`,
    :meth:`IntervalArray.from_breaks`, and :meth:`IntervalArray.from_tuples`.
    )rI�summaryrK�extra_attributes�
extra_methods�examplesc	�8��eZdZUdZej
xZZedsd��Z	de
d<de
d<de
d<				dt							dud
�Ze								dvd��Z
e			dw							dxd��Zedd	d
�					dyd��Zedzd��Zej$d�ed<eeedddej$d�d�z�			d{							d|d���Zej$d�ed<eeedddej$d�d�z�			d{							d|d���Zej$d�ed<eeedddej$d�d�z�			d{							d|d���Zed}d��Zd~d�Zedd ��Zed�d!��Zed�d"��Zd�d#�Zd�d$�Zed�d%��Z ed�d&��Z d�d'�Z d�d(�Z!d)�Z"e#d*�d+��Z$e#d,�d-��Z%e#d.�d/��Z&e#d0�d1��Z'e#d2�d3��Z(e#d4�d5��Z)dd6d7d8�							d��fd9�Z*ddd:�d�d;�Z+ddd:�d�d<�Z,dddd=�									d��fd>�Z-	d�					d��fd?�
Z.d�d��fd@�
Z/d�dA�Z0ed�dB��Z1d~dC�Z2d�dD�Z3d�d�dE�Z4d	dddF�			d�dG�Z5dH�Z6dI�Z7dJ�Z8d�d�dK�Z9d�d�dL�Z:ed�dM��Z;ed�dN��Z<ed�dO��Z=ed�dP��Z>ej$dQ�edR<eedRdej$dS�dT�z�dU��Z?ed�dV��Z@ej$dW�edX<eedXdej$dY�dT�z�d�dZ��ZAd[ed\<eeed\eBz�d�d]���ZC	d�					d�d^�ZDd�d_�ZEej$d`�eda<eedadbej$dc�dd�z�d�d�de��ZFd�df�ZGd�dg�ZHd~dh�ZIeeJdieBz�	d�					d�dj��ZKej$dk�edl<eedldej$dm�dT�z�dn��ZLd�do�ZMed�dp��ZNd�dq�ZOd�dr�ZP�xZQS)�rGTc��y)N����selfs �F/usr/local/lib/python3.12/site-packages/pandas/core/arrays/interval.py�ndimzIntervalArray.ndim�s����IntervalSide�_left�_rightr+�_dtypeNFc�N�t|d��}t||�r@|j}|j}|xs|j}t|j|��}n�t|�r|j�d|�d�}t|��t|�}t||du��\}}}	|jtk(r*tj|�}tj|�}|xs|	}|j|||||��\}}}|r|j!|||��|j#|||��S)	NT��
extract_numpy��closedz5(...) must be called with a collection of some kind, z was passed)�validate_closed�rb�copy�dtype�rf)r>�
isinstancer[r\rbr+rfr&�__name__�	TypeError� _maybe_convert_platform_intervalr�objectr
�maybe_convert_objects�_ensure_simple_new_inputs�	_validate�_simple_new)
�cls�datarbrfre�verify_integrity�left�right�msg�infer_closeds
          rW�__new__zIntervalArray.__new__�s=���T��6���d�C� �!%���D�"&�+�+�E��*�t�{�{�F�!�$�*�*�V�<�E�����|�|�n�%%�%)�F�+�7�� ��n�$�4�D�9�D�(D��f��n�)�%�D�%���z�z�V�#��0�0��6���1�1�%�8���+�|�F�!$�!>�!>������"?�"��D�%����M�M�$��U�M�3��������
�	
rYc�Z�tj|�}||_||_||_|S�N)r
rxr[r\r])rqrtrurf�results     rWrpzIntervalArray._simple_news.���&�&�s�+�������
���
��
rYc��ddlm}|||��}t|�}|||��}t|�}|�t|t�r|j
}|xsd}|��t
|�}t|t�rC|j�G|j|j�}|j|j�}nd|��}t|��|j
�t	|j|�}n||j
k7rtd��t|j�r1t|j�r|j|j�}nEt|j�r0t|j�r|j|j�}t|�t|�k7r:dt|�j�dt|�j�d	�}t|��t|jt �st#|j�r
d
}t|��t|t$�r
d}t|��t|t&�rSt)|j*�t)|j*�k7r(d|j*�d
|j*�d�}t|��t-|j�rQ|j.|j.k7r8|j0j3|j0�\}}	||�}||	�}t5|�}t7|d��}t5|�}t7|d��}t|t8�st|t8�rn^t;|d|�}
t;|
d|
�j<}
t;|d|�}t;|d|�j<}|
�|
|ur|j?�}t	|j|��}|||fS)z;Ensure correctness of input parameters for cls._simple_new.r)�ensure_index�reruz$dtype must be an IntervalDtype, got z*closed keyword does not match dtype.closedzmust not have differing left [z
] and right [z] typeszIcategory, object, and string subtypes are not supported for IntervalArrayz:Period dtypes are not supported, use a PeriodIndex insteadz2left and right must have the same time zone, got 'z' and '�'Tr_�_ndarray�_datara) �pandas.core.indexes.baser}r!rhr+rbr)�subtype�astyperj�
ValueErrorr"rfr#�typerir*r'r/r-�str�tzr(�unitr��_ensure_matching_resosr=r>r7�getattr�basere)rqrtrurbrerfr}rv�left_arr�	right_arr�lbase�rbases            rWrnz'IntervalArray._ensure_simple_new_inputs&s4��	:��D�t�,��,�T�2���U��.��-�e�4���>�j��
�>��\�\�F��"�7���� ��'�E��%��/��=�=�,��;�;�u�}�}�5�D�!�L�L����7�E�<�U�G�D����n�$��|�|�#�%�e�m�m�V�<���5�<�<�'� �!M�N�N��$�*�*�%�*:�5�;�;�*G��L�L����,�E�
�E�K�K�
(�-=�d�j�j�-I��;�;�u�{�{�+�D���:��e��$�0��d��1D�1D�0E�F��u�+�.�.�/�w�8�
��S�/�!��d�j�j�"2�3��t�z�z�7R�$�
��C�.� ��d�N�+�N�C��S�/�!��d�,�-�#�d�g�g�,�#�e�h�h�-�2O���G�G�9�G�E�H�H�:�Q�0�
��S�/�!�
 ����
,����e�j�j�1H�"&�*�*�"C�"C�E�K�K�"P��H�i���)�D� ��+�E�.�d�3���T��6��.�u�5���e�4�8���d�/�0�J��&�5
�
��D�*�d�3�E��E�7�E�2�7�7�E��E�:�u�5�E��E�7�E�2�7�7�E�� �U�e�^��
�
����d�j�j��8���U�E�!�!rY�rfrec��||||��S)Nr�rT)rq�scalarsrfres    rW�_from_sequencezIntervalArray._from_sequence�s���7�%�d�3�3rYc�<�|j||j��S)Nrg)r�rf)rq�values�originals   rW�_from_factorizedzIntervalArray._from_factorized�s���!�!�&����!�?�?rYac
        Construct an %(klass)s from an array of splits.

        Parameters
        ----------
        breaks : array-like (1-dimensional)
            Left and right bounds for each interval.
        closed : {'left', 'right', 'both', 'neither'}, default 'right'
            Whether the intervals are closed on the left-side, right-side, both
            or neither.        %(name)s
        copy : bool, default False
            Copy the data.
        dtype : dtype or None, default None
            If None, dtype will be inferred.

        Returns
        -------
        %(klass)s

        See Also
        --------
        interval_range : Function to create a fixed frequency IntervalIndex.
        %(klass)s.from_arrays : Construct from a left and right array.
        %(klass)s.from_tuples : Construct from a sequence of tuples.

        %(examples)s        �from_breaksrHz�        Examples
        --------
        >>> pd.arrays.IntervalArray.from_breaks([0, 1, 2, 3])
        <IntervalArray>
        [(0, 1], (1, 2], (2, 3]]
        Length: 3, dtype: interval[int64, right]
        )rIrKrPc�P�t|�}|j|dd|dd|||��S)N���rS�rerf)rk�from_arrays)rq�breaksrbrerfs     rWr�zIntervalArray.from_breaks�s4��22�&�9�����v�c�r�{�F�1�2�J��T�QV��W�WrYaC
        Construct from two arrays defining the left and right bounds.

        Parameters
        ----------
        left : array-like (1-dimensional)
            Left bounds for each interval.
        right : array-like (1-dimensional)
            Right bounds for each interval.
        closed : {'left', 'right', 'both', 'neither'}, default 'right'
            Whether the intervals are closed on the left-side, right-side, both
            or neither.        %(name)s
        copy : bool, default False
            Copy the data.
        dtype : dtype, optional
            If None, dtype will be inferred.

        Returns
        -------
        %(klass)s

        Raises
        ------
        ValueError
            When a value is missing in only one of `left` or `right`.
            When a value in `left` is greater than the corresponding value
            in `right`.

        See Also
        --------
        interval_range : Function to create a fixed frequency IntervalIndex.
        %(klass)s.from_breaks : Construct an %(klass)s from an array of
            splits.
        %(klass)s.from_tuples : Construct an %(klass)s from an
            array-like of tuples.

        Notes
        -----
        Each element of `left` must be less than or equal to the `right`
        element at the same position. If an element is missing, it must be
        missing in both `left` and `right`. A TypeError is raised when
        using an unsupported type for `left` or `right`. At the moment,
        'category', 'object', and 'string' subtypes are not supported.

        %(examples)s        r�z�        Examples
        --------
        >>> pd.arrays.IntervalArray.from_arrays([0, 1, 2], [1, 2, 3])
        <IntervalArray>
        [(0, 1], (1, 2], (2, 3]]
        Length: 3, dtype: interval[int64, right]
        c��t|�}t|�}|j|||||��\}}}|j|||��|j|||��S)Nrdrg)rkrnrorp)rqrtrurbrerfs      rWr�zIntervalArray.from_arrayssl��40��5��0��7�� �:�:������;�
���e�U�	�
�
�d�E��
�/����t�U�%��8�8rYa�
        Construct an %(klass)s from an array-like of tuples.

        Parameters
        ----------
        data : array-like (1-dimensional)
            Array of tuples.
        closed : {'left', 'right', 'both', 'neither'}, default 'right'
            Whether the intervals are closed on the left-side, right-side, both
            or neither.        %(name)s
        copy : bool, default False
            By-default copy the data, this is compat only and ignored.
        dtype : dtype or None, default None
            If None, dtype will be inferred.

        Returns
        -------
        %(klass)s

        See Also
        --------
        interval_range : Function to create a fixed frequency IntervalIndex.
        %(klass)s.from_arrays : Construct an %(klass)s from a left and
                                    right array.
        %(klass)s.from_breaks : Construct an %(klass)s from an array of
                                    splits.

        %(examples)s        �from_tuplesz�        Examples
        --------
        >>> pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 2)])
        <IntervalArray>
        [(0, 1], (1, 2]]
        Length: 2, dtype: interval[int64, right]
        c��t|�rgg}}n|x}}|D]d}t|t�st|�rtj
x}}	n|j}
	|\}}	|j|�|j|	��f|j|||d|��S#t$r}|
�d|��}t|�|�d}~wt$r}|
�d|��}t|�|�d}~wwxYw)Nz..from_tuples requires tuples of length 2, got z'.from_tuples received an invalid item, Fr�)�lenrh�tupler1�np�nanrir�rj�appendr�)
rqrrrbrerfrtru�d�lhs�rhsrK�errrvs
             rWr�zIntervalArray.from_tuplesLs���2�t�9��b�%�D� ��D�5��A��a��'�D��G��F�F�"��c��|�|��2� �H�C��
�K�K����L�L����"���t�U�F��e��L�L��"�3�!�F�"P�QR�PS�T�C�$�S�/�s�2�� �2�!�F�"I�!��M�C�#�C�.�c�1��2�s$�B�	C�B0�0C�<C�Cc�D�t|t�sd|��}t|��t|�t|�k7r
d}t|��t	|�}t	|�}||k(j�s
d}t|��||||kj�s
d}t|��y)z�
        Verify that the IntervalArray is valid.

        Checks that

        * dtype is correct
        * left and right match lengths
        * left and right have the same missing values
        * left is always below right
        zinvalid dtype: z(left and right must have the same lengthzMmissing values must be missing in the same location both left and right sidesz+left side of interval must be <= right sideN)rhr+r�r�r2�all)rqrtrurfrv�	left_mask�
right_masks       rWrozIntervalArray._validate~s����%��/�#�E�7�+�C��S�/�!��t�9��E�
�"�<�C��S�/�!��$�K�	��5�\�
��Z�'�,�,�.�5�
��S�/�!��Y��5��#3�3�8�8�:�?�C��S�/�!�;rYc��t|j|j��}|j|||��\}}}|j	|||��S)a#
        Return a new IntervalArray with the replacement attributes

        Parameters
        ----------
        left : Index
            Values to be used for the left-side of the intervals.
        right : Index
            Values to be used for the right-side of the intervals.
        rarg)r+rfrbrnrp�rVrtrurfs    rW�
_shallow_copyzIntervalArray._shallow_copy�sN���d�j�j����=��!�;�;�D�%�u�;�U���e�U�����e�5��9�9rYc��|jSrz)r]rUs rWrfzIntervalArray.dtype�s���{�{�rYc�\�|jj|jjzSrz)rt�nbytesrurUs rWr�zIntervalArray.nbytes�s!���y�y���$�*�*�"3�"3�3�3rYc�.�|jjSrz)rt�sizerUs rWr�zIntervalArray.size�s���y�y�~�~�rYc�>�ttj|��Srz)�iterr��asarrayrUs rW�__iter__zIntervalArray.__iter__�s���B�J�J�t�$�%�%rYc�,�t|j�Srz)r�r[rUs rW�__len__zIntervalArray.__len__�s���4�:�:��rYc��yrzrT�rV�keys  rW�__getitem__zIntervalArray.__getitem__����rYc��yrzrTr�s  rWr�zIntervalArray.__getitem__�r�rYc��t||�}|j|}|j|}t|tj
tf�s9t|�rt|�r|jSt|||j�St	j|�dkDrtd��|j|||j��S)NrSz&multi-dimensional indexing not allowedrg)r?r[r\rhr��ndarrayr8r&r1�_fill_valuerrbrXr�rprf)rVr�rtrus    rWr�zIntervalArray.__getitem__�s���!�$��,���z�z�#������C� ���$����^� <�=����4��:��'�'�'��D�%����5�5�
�7�7�4�=�1���E�F�F�
����e�4�:�:��>�>rYc��|j|�\}}t||�}||j|<||j|<yrz)�_validate_setitem_valuer?r[r\)rVr��value�
value_left�value_rights     rW�__setitem__zIntervalArray.__setitem__�s>��"&�">�">�u�"E��
�K�!�$��,��$��
�
�3��&����C�rYc���t|�r.t|�t|�k7rtd��t|�}n~t	|t
�sn|turYddlm}tj|jt��}tj|jt��}|||�St|||�St	|t
�rtd�}n�t	|j t"�s
|j }n�|j$j }t	|t&�rv|j(|j$j(k7r
t|||�S|j$j*j-|j.d|j$j0��}t	|t&��r�|j(|j(k7r
t|||�St	|t
�st3|�|�}|t4j6ur3|j8|j:k(|j<|j>k(zS|t4j@ur3|j8|j:k7|j<|j>k7zS|t4jBurM|j8|j:kD|j8|j:k(|j<|j>kDzzS|t4jDur||k(||kDzS|t4jFurM|j8|j:k|j8|j:k(|j<|j>kzzS||k(||kzStI|�s
t|||�StjJt|�t��}tM|�D]\}}		||||	�||<�|S#tN$r+|	tur|jQtR�}t||<n�Y�MwxYw)NzLengths must match to comparer)�BooleanArrayrg�intervalT��
allow_fill�
fill_value)*r$r�r��pd_arrayrhrr�pandas.core.arraysr�r��empty�shape�bool�onesr@r)rfr*�
categoriesr+rb�_valuesr4�codes�	_na_valuer��operator�eqr[rtr\ru�ne�gt�gerr%�zeros�	enumeraterjr�rl)
rV�other�opr��arr�mask�other_dtyper{�i�objs
          rW�_cmp_methodzIntervalArray._cmp_method�s;������4�y�C��J�&� �!@�A�A��U�O�E��E�8�,���{�;��h�h�t�z�z��6���w�w�t�z�z��6��#�C��.�.�%�d�E�2�6�6��e�X�&�&�z�2�K��E�K�K�)9�:��+�+�K� �*�*�0�0�K��+�}�5��;�;�%�"2�"2�"9�"9�9�-�d�E�2�>�>��(�(�0�0�5�5��K�K�D�U�=M�=M�=W�=W�6���
�k�=�1��{�{�e�l�l�*�)�$��r�:�:���x�0�"��T�
�5�)���X�[�[� ��
�
�e�j�j�0�T�[�[�E�K�K�5O�P�P��x�{�{�"��
�
�e�j�j�0�T�[�[�E�K�K�5O�P�P��x�{�{�"��
�
�U�Z�Z�/��Z�Z�5�:�:�-�$�+�+����2K�L����x�{�{�"���
�$��,�7�7��x�{�{�"��
�
�U�Z�Z�/��Z�Z�5�:�:�-�$�+�+����2K�L���
��
�$��,�7�7��{�+�%�d�E�2�6�6����#�d�)�4�0����&�F�A�s�	
��t�A�w��,��q�	�'��
���
��"�9�$�]�]�6�2�F� "�F�1�I���
�s�-O�1O4�3O4�__eq__c�B�|j|tj�Srz)r�r�r��rVr�s  rWr�zIntervalArray.__eq__6�������x�{�{�3�3rY�__ne__c�B�|j|tj�Srz)r�r�r�r�s  rWr�zIntervalArray.__ne__:r�rY�__gt__c�B�|j|tj�Srz)r�r�r�r�s  rWr�zIntervalArray.__gt__>r�rY�__ge__c�B�|j|tj�Srz)r�r�r�r�s  rWr�zIntervalArray.__ge__Br�rY�__lt__c�B�|j|tj�Srz)r�r�rr�s  rWr�zIntervalArray.__lt__Fr�rY�__le__c�B�|j|tj�Srz)r�r�rr�s  rWr�zIntervalArray.__le__Jr�rY�	quicksort�last��	ascending�kind�na_positionc����tj|d|�}|r5|dk(r0|dk(r+tj|j|j
f�St
�|�d|||d�|��S)NrTr�r�r�)�nv�validate_argsort_with_ascendingr��lexsortrurt�super�argsort)rVr�r�r��kwargs�	__class__s     �rWrzIntervalArray.argsortNso����6�6�y�"�f�M�	����,���1F��:�:�t�z�z�4�9�9�5�6�6��w��
��d��
�GM�
�	
rY)�axis�skipnac��tj||j�t|�s|jS|j�}|j
�r|s|jS||}n|}|j�d}||S)Nr�r�validate_minmax_axisrXr�r�r1�anyr�rVrrr�r��indexers      rW�minzIntervalArray.minbsr��
����d�i�i�0��4�y��>�>�!��y�y�{���8�8�:���~�~�%���u�+�C��C��+�+�-��"���7�|�rYc��tj||j�t|�s|jS|j�}|j
�r|s|jS||}n|}|j�d}||S)Nr�r
r
s      rW�maxzIntervalArray.maxssr��
����d�i�i�0��4�y��>�>�!��y�y�{���8�8�:���~�~�%���u�+�C��C��+�+�-��#���7�|�rY)�limit�
limit_arearec�*��t�|�||||��S)N)�methodrrre)r�_pad_or_backfill)rVrrrrers     �rWrzIntervalArray._pad_or_backfill�s%����w�'���:�D�(�
�	
rYc���|durt�|�t�	|�	|||��S|j|�\}}|jj|��}|j
j|��}|j
||�S)a
        Fill NA/NaN values using the specified method.

        Parameters
        ----------
        value : scalar, dict, Series
            If a scalar value is passed it is used to fill all missing values.
            Alternatively, a Series or dict can be used to fill in different
            values for each index. The value should not be a list. The
            value(s) passed should be either Interval objects or NA/NaN.
        method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
            (Not implemented yet for IntervalArray)
            Method to use for filling holes in reindexed Series
        limit : int, default None
            (Not implemented yet for IntervalArray)
            If method is specified, this is the maximum number of consecutive
            NaN values to forward/backward fill. In other words, if there is
            a gap with more than this number of consecutive NaNs, it will only
            be partially filled. If method is not specified, this is the
            maximum number of entries along the entire axis where NaNs will be
            filled.
        copy : bool, default True
            Whether to make a copy of the data before filling. If False, then
            the original should be modified and no new memory should be allocated.
            For ExtensionArray subclasses that cannot do this, it is at the
            author's discretion whether to ignore "copy=False" or to raise.

        Returns
        -------
        filled : IntervalArray with NA/NaN filled
        F)r�rr)r�)�NotImplementedErrorr�fillna�_validate_scalarrtrur�)
rVr�rrrer�r�rtrurs
         �rWrzIntervalArray.fillna�s����D�5�=�%�%����7�>��f�E�>�J�J�"&�"7�"7��">��
�K��y�y���j��1���
�
�!�!��!�4���!�!�$��.�.rYc�,��ddlm}|�t|�}t|t�r�||j
k(r|r|j
�S|St|j
j�r3t|j�rd|j
�d|�d�}t|��	||jd��j|j�}||jd��j|j�}|j!||�S	t"�|�1||��S#t$r�ttf$r$}d|j
�d|�d�}t|�|�d}~wwxYw#ttf$r,}d	t%|�j&�d
|��}t|�|�d}~wwxYw)a(
        Cast to an ExtensionArray or NumPy array with dtype 'dtype'.

        Parameters
        ----------
        dtype : str or dtype
            Typecode or data-type to which the array is cast.

        copy : bool, default True
            Whether to copy the data, even if not necessary. If False,
            a copy is made only if the old dtype does not match the
            new dtype.

        Returns
        -------
        array : ExtensionArray or ndarray
            ExtensionArray or NumPy ndarray with 'dtype' for its dtype.
        r�rDNzCannot convert z to z; subtypes are incompatibleFr~zCannot cast z
 to dtype )�pandasrDr)rhr+rfrer"r�r(rjr[r�r\rr�r�rr�ri)	rVrfrerDrv�new_left�	new_rightr�rs	        �rWr�zIntervalArray.astype�s����&	!��� ��'�E��e�]�+���
�
�"�&*�t�y�y�{�4��4��d�j�j�0�0�1�6I��
�
�7�
&�d�j�j�\��e�W�<W�X�� ��n�$�
.�!����%�8�?�?��
�
�N��!�$�+�+�E�:�A�A�%�-�-�P�	��%�%�h�	�:�:�
.��w�~�e�$�~�7�7��&�
���z�*�
.�&�d�j�j�\��e�W�<W�X�� ��n�#�-��

.���z�*�
.�$�T�$�Z�%8�%8�$9��E�7�K����n�#�-��
.�s1�AD�E�E�1E�E�F�''F�Fc��t|�t|�k7ryt|j|jk(xrL|jj	|j�xr%|j
j	|j
��S)NF)r�r�rbrt�equalsrur�s  rWr!zIntervalArray.equals�sh����:��e��$����K�K�5�<�<�'�
/��	�	� � ����,�
/��
�
�!�!�%�+�+�.�
�	
rYc��|D�chc]}|j��}}t|�dk7rtd��|j�}t	j
|D�cgc]}|j��c}�}t	j
|D�cgc]}|j��c}�}|j|||��\}}}|j|||��Scc}wcc}wcc}w)z�
        Concatenate multiple IntervalArray

        Parameters
        ----------
        to_concat : sequence of IntervalArray

        Returns
        -------
        IntervalArray
        rSz.Intervals must all be closed on the same side.rarg)
rbr�r��popr��concatenatertrurnrp)rq�	to_concatr��
closed_setrbrtrurfs        rW�_concat_same_typezIntervalArray._concat_same_types���7@�@�i�(�h�o�o�i�
�@��z�?�a���M�N�N����!���^�^�9�,U�9�x�X�]�]�9�,U�V�� �n�n�Y�-W�Y��h�n�n�Y�-W�X�� �:�:�4��v�:�V���e�U����t�U�%��8�8��A��
-V��-Ws�C	�C�Cc��|jj�}|jj�}|j}|j	|||��S)zd
        Return a copy of the array.

        Returns
        -------
        IntervalArray
        rg)r[rer\rfrpr�s    rWrezIntervalArray.copysG���z�z��� ����� � �"���
�
������e�5��9�9rYc�,�t|j�Srz)r1r[rUs rWr1zIntervalArray.isna,s���D�J�J��rYc���t|�r|dk(r|j�S|j|�tt	|�t|��}t|�rAddlm}||jd��j}tj|g|dzz�}n!|j|g|z|j��}|dkDr	|}|d|}n|t	|�d}|}|j||g�S)NrrFr~rSrg)r�rerr�absr1rrDr[r�rGr�r�rfr')rV�periodsr��	empty_lenrDr��a�bs        rW�shiftzIntervalArray.shift/s����4�y�G�q�L��9�9�;�����j�)���G��c�$�i�0�	��
��$��t�z�z��6�@�@�J�!�-�-�z�l�i�!�m�.L�M�E��'�'���y�(@��
�
�'�S�E��Q�;��A��Y�w�h��A��S��\�^�$�A��A��%�%�q�!�f�-�-rY)r�r�rc���tjd|�|x}}|r|j|�\}}t|j|||��}t|j
|||��}	|j
||	�S)am
        Take elements from the IntervalArray.

        Parameters
        ----------
        indices : sequence of integers
            Indices to be taken.

        allow_fill : bool, default False
            How to handle negative values in `indices`.

            * False: negative values in `indices` indicate positional indices
              from the right (the default). This is similar to
              :func:`numpy.take`.

            * True: negative values in `indices` indicate
              missing values. These values are set to `fill_value`. Any other
              other negative values raise a ``ValueError``.

        fill_value : Interval or NA, optional
            Fill value to use for NA-indices when `allow_fill` is True.
            This may be ``None``, in which case the default NA value for
            the type, ``self.dtype.na_value``, is used.

            For many ExtensionArrays, there will be two representations of
            `fill_value`: a user-facing "boxed" scalar, and a low-level
            physical NA value. `fill_value` should be the user-facing version,
            and the implementation should handle translating that to the
            physical version for processing the take if necessary.

        axis : any, default None
            Present for compat with IntervalIndex; does nothing.

        Returns
        -------
        IntervalArray

        Raises
        ------
        IndexError
            When the indices are out of bounds for the array.
        ValueError
            When `indices` contains negative values other than ``-1``
            and `allow_fill` is True.
        rTr�)r�
validate_takerr4r[r\r�)
rV�indicesr�r�rr�	fill_left�
fill_right�	left_take�
right_takes
          rWr4zIntervalArray.takeKs|��l	����V�$�!+�+�	�J��$(�$9�$9�*�$E�!�I�z���J�J��J�9�
�	���K�K��Z�J�
�
��!�!�)�Z�8�8rYc�l�	t|�}|j|d��|j|j}}	|jj
|�||fS#t$r }dt|��d�}t	|�|�d}~wwxYw#ttf$r }dt|��d�}t	|�|�d}~wwxYw)Nr��rKz('value' should be an interval type, got z	 instead.z2'value' should be a compatible interval type, got )rG�_check_closed_matchesrtrurjr��_validate_fill_valuer )rVr�r<r�r�r�rvs       rW�_validate_listlikez IntervalArray._validate_listlike�s���	*�!�%�(�E��&�&�u�7�&�;�&+�j�j�%�+�+��J�	*��I�I�*�*�:�6��;�&�&���	*�<�T�%�[�M��S�C��C�.�c�)��	*��"�9�-�	*���E�{�m�9�.�
��C�.�c�)��	*�s.�6A�B�	B�!A<�<B�B3�B.�.B3c��t|t�r/|j|d��|j|j}}||fSt||jj�r|jjx}}||fStd��)Nr�r9z=can only insert Interval objects and NA into an IntervalArray)	rhrr:rtrur0rfr�rj)rVr�rtrus    rWrzIntervalArray._validate_scalar�s����e�X�&��&�&�u�7�&�;��*�*�e�k�k�%�D��U�{��#�5�$�)�)�/�/�
:��9�9�.�.�.�D�5�
�U�{���O��
rYc���t||jj�rH|jj}t	|jj
�rt
d��||}}||fSt|t�re|j|d��|j|j}}|jj|�|jj|�||fS|j|�S)Nz4Cannot set float NaN to integer-backed IntervalArrayr�r9)
r0rtrfr�r#r�rjrhrr:rur;r<)rVr�r�r�s    rWr�z%IntervalArray._validate_setitem_value�s��� ���	�	���8��I�I�'�'�E���
�
� 2� 2�3� � V�W�W�&+�U��J��;�&�&���x�
(��&�&�u�7�&�;�&+�j�j�%�+�+��J��I�I�*�*�:�6��I�I�*�*�;�7�
�;�&�&��*�*�5�1�1rYc���tj�5tjddt��t	tj|�|��}ddd�|S#1swYSxYw)a2
        Returns a Series containing counts of each interval.

        Parameters
        ----------
        dropna : bool, default True
            Don't include counts of NaN.

        Returns
        -------
        counts : Series

        See Also
        --------
        Series.value_counts
        �ignorez<The behavior of value_counts with object-dtype is deprecated)�category)�dropnaN)�warnings�catch_warnings�filterwarnings�
FutureWarning�value_countsr�r�)rVrBr{s   rWrGzIntervalArray.value_counts�sW��$�
$�
$�
&��#�#��N�&�
�
"�"�*�*�T�"2�6�B�F�
'��
�'��
�s�=A�A&c��tSrz)r�)rV�boxeds  rW�
_formatterzIntervalArray._formatter�s	���
rYc�6�ddlm}||jd��S)a�
        Return the left endpoints of each Interval in the IntervalArray as an Index.

        Examples
        --------

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(2, 5)])
        >>> interv_arr
        <IntervalArray>
        [(0, 1], (2, 5]]
        Length: 2, dtype: interval[int64, right]
        >>> interv_arr.left
        Index([0, 2], dtype='int64')
        rrFr~)rrDr[�rVrDs  rWrtzIntervalArray.left�s�� 	!��T�Z�Z�e�,�,rYc�6�ddlm}||jd��S)a�
        Return the right endpoints of each Interval in the IntervalArray as an Index.

        Examples
        --------

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(2, 5)])
        >>> interv_arr
        <IntervalArray>
        [(0, 1], (2, 5]]
        Length: 2, dtype: interval[int64, right]
        >>> interv_arr.right
        Index([1, 5], dtype='int64')
        rrFr~)rrDr\rLs  rWruzIntervalArray.rights�� 	!��T�[�[�u�-�-rYc�4�|j|jz
S)a�
        Return an Index with entries denoting the length of each Interval.

        Examples
        --------

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
        >>> interv_arr
        <IntervalArray>
        [(0, 1], (1, 5]]
        Length: 2, dtype: interval[int64, right]
        >>> interv_arr.length
        Index([1, 4], dtype='int64')
        )rurtrUs rW�lengthzIntervalArray.lengths�� �z�z�D�I�I�%�%rYc��	d|j|jzzS#t$r|jd|jzzcYSwxYw)a�
        Return the midpoint of each Interval in the IntervalArray as an Index.

        Examples
        --------

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
        >>> interv_arr
        <IntervalArray>
        [(0, 1], (1, 5]]
        Length: 2, dtype: interval[int64, right]
        >>> interv_arr.mid
        Index([0.5, 3.0], dtype='float64')
        g�?)rtrurjrOrUs rW�midzIntervalArray.mid-sF�� 	1��$�)�)�d�j�j�0�1�1���	1��9�9�s�T�[�[�0�0�0�	1�s��%A�AaI
        Check elementwise if an Interval overlaps the values in the %(klass)s.

        Two intervals overlap if they share a common point, including closed
        endpoints. Intervals that only have an open endpoint in common do not
        overlap.

        Parameters
        ----------
        other : %(klass)s
            Interval to check against for an overlap.

        Returns
        -------
        ndarray
            Boolean array positionally indicating where an overlap occurs.

        See Also
        --------
        Interval.overlaps : Check whether two Interval objects overlap.

        Examples
        --------
        %(examples)s
        >>> intervals.overlaps(pd.Interval(0.5, 1.5))
        array([ True,  True, False])

        Intervals that share closed endpoints overlap:

        >>> intervals.overlaps(pd.Interval(1, 3, closed='left'))
        array([ True,  True, True])

        Intervals that only have an open endpoint in common do not overlap:

        >>> intervals.overlaps(pd.Interval(1, 2, closed='right'))
        array([False,  True, False])
        �overlapsz�        >>> data = [(0, 1), (1, 3), (2, 4)]
        >>> intervals = pd.arrays.IntervalArray.from_tuples(data)
        >>> intervals
        <IntervalArray>
        [(0, 1], (1, 3], (2, 4]]
        Length: 3, dtype: interval[int64, right]
        )rIrPc��t|ttf�rt�t|t�s#dt|�j��}t|��|jr|jrtnt}|jr|jrtnt}||j|j�||j|j�zS)Nz#`other` must be Interval-like, got )rhrGr.rrr�rirj�closed_left�closed_rightrrrtru)rVr�rv�op1�op2s     rWrRzIntervalArray.overlapsks���"�e�m�-=�>�?�%�%��%��*�7��U��8L�8L�7M�N�C��C�.� ��%�%�%�*<�*<�b�2���&�&�4�+<�+<�b�2��
�4�9�9�e�k�k�*�S����T�Z�Z�-H�H�HrYc�.�|jjS)a�
        String describing the inclusive side the intervals.

        Either ``left``, ``right``, ``both`` or ``neither``.

        Examples
        --------

        For arrays:

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
        >>> interv_arr
        <IntervalArray>
        [(0, 1], (1, 5]]
        Length: 2, dtype: interval[int64, right]
        >>> interv_arr.closed
        'right'

        For Interval Index:

        >>> interv_idx = pd.interval_range(start=0, end=2)
        >>> interv_idx
        IntervalIndex([(0, 1], (1, 2]], dtype='interval[int64, right]')
        >>> interv_idx.closed
        'right'
        )rfrbrUs rWrbzIntervalArray.closed�s��8�z�z� � � rYaZ
        Return an identical %(klass)s closed on the specified side.

        Parameters
        ----------
        closed : {'left', 'right', 'both', 'neither'}
            Whether the intervals are closed on the left-side, right-side, both
            or neither.

        Returns
        -------
        %(klass)s

        %(examples)s        �
set_closedav        Examples
        --------
        >>> index = pd.arrays.IntervalArray.from_breaks(range(4))
        >>> index
        <IntervalArray>
        [(0, 1], (1, 2], (2, 3]]
        Length: 3, dtype: interval[int64, right]
        >>> index.set_closed('both')
        <IntervalArray>
        [[0, 1], [1, 2], [2, 3]]
        Length: 3, dtype: interval[int64, both]
        c��|tvrd|��}t|��|j|j}}t	|j
|��}|j
|||��S)Nzinvalid option for 'closed': rarg)rr�r[r\r+rfrp)rVrbrvrtrurfs      rWrYzIntervalArray.set_closed�s[��,��%�1�&��:�C��S�/�!��j�j�$�+�+�e���d�j�j��8������e�5��9�9rYak
        Return a boolean whether the %(klass)s is non-overlapping and monotonic.

        Non-overlapping means (no Intervals share points), and monotonic means
        either monotonic increasing or monotonic decreasing.

        Examples
        --------
        For arrays:

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
        >>> interv_arr
        <IntervalArray>
        [(0, 1], (1, 5]]
        Length: 2, dtype: interval[int64, right]
        >>> interv_arr.is_non_overlapping_monotonic
        True

        >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1),
        ...                                       pd.Interval(-1, 0.1)])
        >>> interv_arr
        <IntervalArray>
        [(0.0, 1.0], (-1.0, 0.1]]
        Length: 2, dtype: interval[float64, right]
        >>> interv_arr.is_non_overlapping_monotonic
        False

        For Interval Index:

        >>> interv_idx = pd.interval_range(start=0, end=2)
        >>> interv_idx
        IntervalIndex([(0, 1], (1, 2]], dtype='interval[int64, right]')
        >>> interv_idx.is_non_overlapping_monotonic
        True

        >>> interv_idx = pd.interval_range(start=0, end=2, closed='both')
        >>> interv_idx
        IntervalIndex([[0, 1], [1, 2]], dtype='interval[int64, both]')
        >>> interv_idx.is_non_overlapping_monotonic
        False
        �is_non_overlapping_monotonicc��|jdk(ret|jdd|jddkj	�xs-|jdd|jddkDj	��St|jdd|jddkj	�xs-|jdd|jddk\j	��S)N�bothr�rS)rbr�r\r[r�rUs rWr[z*IntervalArray.is_non_overlapping_monotonics����;�;�&� �����S�b�!�D�J�J�q�r�N�2�7�7�9�=��J�J�s��O�d�k�k�!�"�o�5�:�:�<��
��
�[�[��"�
����A�B��
/�4�4�6�
:��
�
�3�B��4�;�;�q�r�?�2�7�7�9�
�	
rYc�4�|j}|j}|j�}|j}t	j
t
|�t��}t|�D]1\}}	||rtj||<�t|	|||�||<�3|S)zt
        Return the IntervalArray's data as a numpy array of Interval
        objects (with dtype='object')
        rg)r[r\r1rbr�r�r�rlr�r�r)
rVrfrertrur�rbr{r��
left_values
          rW�	__array__zIntervalArray.__array__"s����z�z�������y�y�{���������#�d�)�6�2��&�t�_�M�A�z��A�w��F�F��q�	�$�Z��q��6�B��q�	�	-�
�
rYc�2�ddl}ddlm}	|j|jj
�}|||j�}|jj|j|j|d��|j|j|d��gdd	g�
�}|j�}|j�rv|j|�j�d}	|jj!|j"t%|�|	g|j'd�|j'd�g��}|��|j)|j*�r|St-||�r[|j)|�sYt
d
|jj
�d|j
�d|j�d|j�d�	��t
d|�d���|j.j1||�S#t$r)}t
d|jj
�d��|�d}~wwxYw)z6
        Convert myself into a pyarrow Array.
        rN)�ArrowIntervalTypez"Conversion to arrow with subtype 'z' is not supportedT)r��from_pandasrtru)�namesrS)�childrenzINot supported to convert IntervalArray to type with different 'subtype' (z vs z) and 'closed' (z) attributesz+Not supported to convert IntervalArray to 'z' type)�pyarrow�(pandas.core.arrays.arrow.extension_typesrb�from_numpy_dtyperfr�rjrb�StructArrayr�r<r[r\r1r�buffers�from_buffersr�r��fieldr!�storage_typerhr8�from_storage)
rVr�rfrbr�r��
interval_type�
storage_arrayr��null_bitmaps
          rW�__arrow_array__zIntervalArray.__arrow_array__6s��	�N�	��.�.�t�z�z�/A�/A�B�G�*�'�4�;�;�?�
��+�+�7�7��
�
�d�j�j�w�D�
�I��
�
�d�k�k��T�
�J�
��7�#�8�
�
��y�y�{���8�8�:�!�-�-���.�6�6�8��;�K�#�/�/�<�<��"�"��M�"��
�'�-�-�a�0�-�2E�2E�a�2H�I�	=��M����{�{�=�5�5�6�$�$��D�"3�4��{�{�=�1�#�0�04�
�
�0B�0B�/C�4����~�V)�)-���
�T�$�+�+��l�T��� �A�$��v�N����%�%�2�2�=�-�P�P��Q�	��4�T�Z�Z�5G�5G�4H�I#�#���
��	�s�%G$�$	H�-$H�Ham
        Return an %(return_type)s of tuples of the form (left, right).

        Parameters
        ----------
        na_tuple : bool, default True
            If ``True``, return ``NA`` as a tuple ``(nan, nan)``. If ``False``,
            just return ``NA`` as ``nan``.

        Returns
        -------
        tuples: %(return_type)s
        %(examples)s        �	to_tupleszFndarray (if self is IntervalArray) or Index (if self is IntervalIndex)aq
         Examples
         --------
         For :class:`pandas.IntervalArray`:

         >>> idx = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 2)])
         >>> idx
         <IntervalArray>
         [(0, 1], (1, 2]]
         Length: 2, dtype: interval[int64, right]
         >>> idx.to_tuples()
         array([(0, 1), (1, 2)], dtype=object)

         For :class:`pandas.IntervalIndex`:

         >>> idx = pd.interval_range(start=0, end=2)
         >>> idx
         IntervalIndex([(0, 1], (1, 2]], dtype='interval[int64, right]')
         >>> idx.to_tuples()
         Index([(0, 1), (1, 2)], dtype='object')
         )�return_typerPc���tjt|j|j��}|s4tj|j�|t
j�}|Srz)	�com�asarray_tuplesafe�zipr[r\r��wherer1r�)rV�na_tuple�tupless   rWrszIntervalArray.to_tuples{sJ��B�&�&�s�4�:�:�t�{�{�'C�D����X�X�t�y�y�{�l�F�B�F�F�;�F��
rYc��|j|�\}}t|jtj�ritj
|j||�t|jtj�sJ�tj
|j||�y|jj||�t|jtj�rJ�|jj||�yrz)r�rhr[r�r��putmaskr\�_putmask)rVr�r�r�r�s     rWr~zIntervalArray._putmask�s���"&�">�">�u�"E��
�K��d�j�j�"�*�*�-��J�J�t�z�z�4��4��d�k�k�2�:�:�6�6�6��J�J�t�{�{�D�+�6��J�J����j�1�!�$�+�+�r�z�z�:�:�:��K�K� � ��{�3rYc��|j|�\}}|jj||�}|jj||�}|j	||�S)ac
        Return a new IntervalArray inserting new item at location. Follows
        Python numpy.insert semantics for negative values.  Only Interval
        objects and NA can be inserted into an IntervalIndex

        Parameters
        ----------
        loc : int
        item : Interval

        Returns
        -------
        IntervalArray
        )rrt�insertrur�)rV�loc�item�left_insert�right_insertrrs       rWr�zIntervalArray.insert�sX��%)�$9�$9�$�$?�!��\��9�9�#�#�C��5���J�J�%�%�c�<�8�	��!�!�(�I�6�6rYc��t|jtj�rgtj|j|�}t|j
tj�sJ�tj|j
|�}n\|jj	|�}t|j
tj�rJ�|j
j	|�}|j
||��S)N�rtru)rhr[r�r��deleter\r�)rVr�rrs    rWr�zIntervalArray.delete�s����d�j�j�"�*�*�-��y�y����S�1�H��d�k�k�2�:�:�6�6�6��	�	�$�+�+�s�3�I��z�z�(�(��-�H�!�$�+�+�r�z�z�:�:�:����*�*�3�/�I��!�!�x�y�!�A�ArY�repeatc���tjdd|i�|jj|�}|jj|�}|j||��S)NrTrr�)r�validate_repeatrtr�rur�)rV�repeatsr�left_repeat�right_repeats     rWr�zIntervalArray.repeat�sV��	���2���~�.��i�i�&�&�w�/���z�z�(�(��1���!�!�{�,�!�G�GrYa�
        Check elementwise if the Intervals contain the value.

        Return a boolean mask whether the value is contained in the Intervals
        of the %(klass)s.

        Parameters
        ----------
        other : scalar
            The value to check whether it is contained in the Intervals.

        Returns
        -------
        boolean array

        See Also
        --------
        Interval.contains : Check whether Interval object contains value.
        %(klass)s.overlaps : Check if an Interval overlaps the values in the
            %(klass)s.

        Examples
        --------
        %(examples)s
        >>> intervals.contains(0.5)
        array([ True, False, False])
    �containsz�        >>> intervals = pd.arrays.IntervalArray.from_tuples([(0, 1), (1, 3), (2, 4)])
        >>> intervals
        <IntervalArray>
        [(0, 1], (1, 3], (2, 4]]
        Length: 3, dtype: interval[int64, right]
        c���t|t�rtd��|jr|j|kn|j|k|j
r||jkzS||jkzS)Nz*contains not implemented for two intervals)rhrr�	open_leftr[�
open_rightr\r�s  rWr�zIntervalArray.contains�si�� �e�X�&�%�&R�S�S�&*�n�n��
�
�U�"�$�*�*��:M�#'�?�?�E�D�K�K��
�	
�8=����8L�
�	
rYc��t|t��r|j|jk7r%tj|j
t��S|j|jk(rZ|jjd�}|jjd�}tj||�j�St|jj�t|jj�zr%tj|j
t��St|jt�|jt��S)Nrg�
complex128)rhrGrbr�r�r�r�rf�	_combined�viewr3�ravelr(rtr�rl)rVr�rtrus    rWr3zIntervalArray.isins����f�m�,��{�{�f�m�m�+��x�x��
�
�$�7�7��z�z�V�\�\�)��~�~�*�*�<�8���(�(�-�-�l�;���w�w�t�U�+�1�1�3�3�$�T�Y�Y�_�_�5�8K����!�!�9���x�x��
�
�$�7�7��D�K�K��'����v�)>�?�?rYc�(�|jjjdd�}|jjjdd�}t	|j
�r|j
||gd��}|Stj||gd��}|S)Nr�rS)r)	rtr��reshaperur(rfr'r�r$)rVrtru�combs    rWr�zIntervalArray._combined-s����y�y� � �(�(��Q�/���
�
�"�"�*�*�2�q�1���t�z�z�*��)�)��u�
�A�*��D�
���>�>�4��-�a�8�D��rYc��|jd�jdd�}|jj}t	|�r�t|jttf�sJ�t|j�j|dd�df|��}t|jttf�sJ�t|j�j|dd�df|��}nLt|tj�sJ�|dd�dfj|�}|dd�dfj|�}|j||��S)	zY
        Create a new IntervalArray with our dtype from a 1D complex128 ndarray.
        �i8r��NrrgrSr�)
r�r�r[rfr(rhr:r;r�r�r\r�r�)rV�combined�ncrfrrs      rW�_from_combinedzIntervalArray._from_combined=s
���]�]�4�
 �
(�
(��Q�
/���
�
� � ���u�%��d�j�j�=�.�*I�J�J�J��D�J�J�'�6�6�r�!�Q�$�x�u�6�M�H��d�k�k�M�>�+J�K�K�K��T�[�[�)�8�8��A�q�D���8�O�I��e�R�X�X�.�.�.��!�Q�$�x�}�}�U�+�H��1�a�4��
�
�e�,�I��!�!�x�y�!�A�ArYc��t|jjd�dd�df�}|dd�df}|j|�S)Nr�r)r5r�r�r�)rVr�s  rWr5zIntervalArray.uniqueOsI����N�N����-�a��d�3�
����4��[���"�"�2�&�&rY)�returnz
Literal[1])NNFT)rb�IntervalClosedType | Nonerf�Dtype | Nonerer�rsr�)rtrZrurZrfr+r�r)NFN)rbr�rer�rfr�r�z0tuple[IntervalSide, IntervalSide, IntervalDtype])rfr�rer�r�r)r��
np.ndarrayr�rGr�r)ruFN)rbr�rer�rfr�r�r)rfr+r��None)r�r)r�r+)r��int)r�rB)r�rr��IntervalOrNA)r�rr�r)r�rr�zSelf | IntervalOrNA)r�r�)r�r�r�rr�r�r�r�)r�AxisInt | Nonerr�r�r�)
rrr�
int | Nonerz#Literal['inside', 'outside'] | Nonerer�r�r)NNNT)rr�rer�r�r)T)rer�)r�r�)r%zSequence[IntervalArray]r�r)r�r�)rSN)r,r�r�rlr�rG)r�r�r�r)rBr�r�rE)F)rIr�)r�rD)r�r)rbrr�r)NN)rfzNpDtype | Nonerezbool | Noner�r�rz)rzr�r�r�)r��npt.NDArray[np.bool_]r�r�)r�r�r�rr�r)r�zint | Sequence[int]rr�r�r)r�rr�r�)r�rZ)r�r�r�rG)r�rG)Rri�
__module__�__qualname__�can_hold_nar�r�r�r��propertyrX�__annotations__rx�classmethodrprnr�r��textwrap�dedentrFrr�r�r�ror�rfr�r�r�r�r	r�r�r�rAr�r�r�r�r�r�rrrrrr�r!r'rer1r0r4r<rr�rGrJrtrurOrQrRrbrY�_shared_docs_kwargsr[r`rrrsr~r�r�r9r�r�r3r�r�r5�
__classcell__)rs@rWrGrG�s_���8�K� �f�f�$�I��
����������-1�"��!%�
1
�*�1
��	1
�
�1
��
1
�f�������	�

�����
-1��"�
^"�*�	^"�
�^"��
^"�
:�^"��^"�@�
#��4��	4�
�4�
�
4��4��@��@�,;�8�?�?�	�,��-�(�>�
��m�,�$��'�����	�

�	
��(-4��"�	X�*�	X��		X�
�	X�
�
	X�#��$	X�,;�8�?�?�.	�0,��-�(�d�
��m�,�$��'�����	�

�	
��*-4��"�
9�*�	9�
�9��
9�
�9�#��$9�,,;�8�?�?�	�,��-�(�B�
��m�,�$��'�����	�

�	
��(-4��"�M�*�M��	M�
�M�
�
M�#��$M�@�"��"�::�&�����4��4�����&����������?�&'�M�^�h�'�4�(�4��h�'�4�(�4��h�'�4�(�4��h�'�4�(�4��h�'�4�(�4��h�'�4�(�4��$�!�
��
��	
�
�
�
�
�(-1���"-1���*!�:>��

��
��	
�
8�
��

�
�
�OS�+/�.8�+/�GK�+/�	
�+/�Z;.�z
��9��9�0:� �.�@!��
�
C9��	C9�
�C9�J'�,�'�.�@��-��-�&�.��.�&�&��&�"�1��1�*)8����$	�&)��*�%�P��j�)�$�'�����	�
�
	
�� I�!� I�$�!��!�:+:�(�/�/�	�+��,�'�$��l�+�$�'������
�	
��*:�+�*:�(	��&��X�
��<�=�@S�S��
���
�0AE��#��2=��	��(2Q�h*9����
	�*��+�&�"��k�*�Y�'����
��	
�	
��@�A�@�
4�7�,	B��*�8�4�7J�J�K� $�H�$�H��H�
�	H�L�H�)8����	�)��*�%�<��j�)�$�'������
�	
��
��
�@�8�
��
�B�$'rYc��t|ttf�r3t|�dk(r%t	j
gtj��St|�rt|t�r|Stt|dd�t�rt	j|�}n6t|d�st|tttf�s|St|d��}t|d�sit	j|�}|jj dvr<|jtjk7r|j#tj�}|S)a�
    Try to do platform conversion, with special casing for IntervalArray.
    Wrapper around maybe_convert_platform that alters the default return
    dtype in certain cases to be compatible with IntervalArray.  For example,
    empty lists return with integer dtype instead of object dtype, which is
    prohibited for IntervalArray.

    Parameters
    ----------
    values : array-like

    Returns
    -------
    array
    rrgrfNTr_�iu)rh�listr�r�r�r<�int64r$r,r�r*r��hasattr�ranger>rfr�r�)r�s rWrkrkYs��� �&�4��-�(�S��[�A�-=��x�x��"�(�(�+�+�
�&�
!�Z���%E��
�	�G�F�G�T�2�4D�	E����F�#��
�V�W�
%�j��$��u�AU�.V��
��v�T�:���6�7�#����F�#���<�<����$�������)A��]�]�2�8�8�,�F��MrY)r�r)q�
__future__rr�rrr��typingrrrr	rC�numpyr��pandas._libsr
�pandas._libs.intervalrrr
r�pandas._libs.missingr�pandas._typingrrrrrrrrrrrrr�pandas.compat.numpyrr�
pandas.errorsr�pandas.util._decoratorsr�pandas.core.dtypes.castr r!�pandas.core.dtypes.commonr"r#r$r%r&r'r(r)�pandas.core.dtypes.dtypesr*r+�pandas.core.dtypes.genericr,r-r.r/�pandas.core.dtypes.missingr0r1r2�pandas.core.algorithmsr3r4r5r6rGr�r7�pandas.core.arrays.baser8r9�pandas.core.arrays.datetimesr:�pandas.core.arrays.timedeltasr;�pandas.core.common�core�commonrv�pandas.core.constructionr<r�r=r>�pandas.core.indexersr?�pandas.core.opsr@rA�collections.abcrBrCrrDrEr�rZ�floatr�rFr�r�r�rGrkrTrYrW�<module>r�s}��"�����������$�����/�,�,��	�	�	��������3��7�8� � ���
5��
��
��]�B�J�J�.�/���X�u�_�%��(*��~�*��&����8����z
��'�"� �U����#�H�O�O�
�
�
���6A'�M�>�A'�7�6A'�H4$rY

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