Sindbad~EG File Manager

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

�

MٜgƉ���dZddlmZddlmZddlmZmZmZm	Z	m
Z
ddlZddl
mZmZmZddlmZmZmZmZmZddlmZdd	lmZdd
lmZmZmZmZm Z m!Z!ddl"m#Z#ddl$m%Z%m&Z&m'Z'erdd
l(m)Z)d4d�Z*d5d�Z+e
dd�					d6d��Z,e
						d7d��Z,dd�					d8d�Z,gd�Z-gd�Z.d9d�Z/d:d�Z0				d;d�Z1d<d�Z2						d=d�Z3d>d�Z4						d?																	d@d�Z5dAd�Z6								dB																			dCd �Z7			dD									dEd!�Z8			dF									dGd"�Z9		dH									dId#�Z:			dJ									dKd$�Z;										dLd%�Z<				dM											dNd&�Z=	dO			dPd'�Z>dQd(�Z?e?			dR									dSd)��Z@e?			dR									dSd*��ZAe?			dR							dTd+��ZBe?			dR					dUd,��ZC						dVd-�ZD						dVd.�ZEe@eAd/�ZFdWdXd0�ZGdYd1�ZH						dZd2�ZId[d3�ZJy)\z$
Routines for filling missing data.
�)�annotations)�wraps)�
TYPE_CHECKING�Any�Literal�cast�overloadN)�NaT�algos�lib)�	ArrayLike�AxisInt�F�
ReindexMethod�npt)�import_optional_dependency)�infer_dtype_from)�
is_array_like�
is_bool_dtype�is_numeric_dtype�is_numeric_v_string_like�is_object_dtype�needs_i8_conversion)�DatetimeTZDtype)�is_valid_na_for_dtype�isna�na_value_for_dtype��Indexc�v�t|�r-t|�|k7rtdt|��d|����||}|S)zJ
    Validate the size of the values passed to ExtensionArray.fillna.
    z'Length of 'value' does not match. Got (z)  expected )r�len�
ValueError)�value�mask�lengths   �>/usr/local/lib/python3.12/site-packages/pandas/core/missing.py�check_value_sizer'3sP���U���u�:����9�#�e�*��F�#�H�&��
��d����L�c��t|�\}}t|tj�rtj||��}n<|j�}t
j|�s|g}|j||d��}d}t|j�rd}t|�}t|�}||}tj|jt��}t|j�r+t|j�st|j�rn�t|j�r+t|j�rt|j�sn�|D]�}	t!||	�r�|r;tj|jtj"��}
||	k(|
|<n6||	k(}
t|
tj$�s|
j'td��}
||
z}��|j)�r|t|�z}|S)a	
    Return a masking array of same size/shape as arr
    with entries equaling any member of values_to_mask set to True

    Parameters
    ----------
    arr : ArrayLike
    values_to_mask: list, tuple, or scalar

    Returns
    -------
    np.ndarray[bool]
    )�dtypeF)r*�copyT)r*�na_value)r�
isinstance�npr*�array�construct_array_typer�is_list_like�_from_sequencerr�zeros�shape�boolrrr�bool_�ndarray�to_numpy�any)�arr�values_to_maskr*�cls�potential_na�arr_mask�na_mask�nonnar$�x�new_masks           r&�mask_missingrCBs���"-�^�<��E�>��%����"����.��>���(�(�*������/�,�-�N��+�+�N�%�e�+�T���L��s�y�y�!�����I�:���>�"�G��G�8�$�E��8�8�C�I�I�T�*�D�����#��c�i�i�(��%�+�+�&���c�i�i� ��U�[�[�)��e�k�k�*���A�'��Q�/���!�x�x��	�	����B�H�),�X��!�);�H�X�&�"�a�x�H�%�h��
�
�;�#+�#4�#4�4�%�#4�#P���� ��� �{�{�}���S�	����Kr(.��
allow_nearestc��y�N���methodrEs  r&�clean_fill_methodrK����r(c��yrGrHrIs  r&rKrK�rLr(Fc���t|t�r|j�}|dk(rd}n|dk(rd}ddg}d}|r|jd�d}||vrt	d|�d	|����|S)
N�ffill�pad�bfill�backfillzpad (ffill) or backfill (bfill)�nearestz(pad (ffill), backfill (bfill) or nearestzInvalid fill method. Expecting z. Got )r-�str�lower�appendr")rJrE�
valid_methods�	expectings    r&rKrK�s���
�&�#��������W���F�
�w�
��F��J�'�M�1�I�����Y�'�>�	�
�]�"��:�9�+�V�F�8�T�U�U��Mr()�linear�time�index�values)rS�zero�slinear�	quadratic�cubic�barycentric�krogh�spline�
polynomial�from_derivatives�piecewise_polynomial�pchip�akima�cubicsplinec���|jd�}|dvr
|�td��ttz}||vrtd|�d|�d���|dvr|jst|�d���|S)	N�order)rcrdz7You must specify the order of the spline or polynomial.zmethod must be one of z. Got 'z
' instead.)rbrfrgz4 interpolation requires that the index be monotonic.)�getr"�
NP_METHODS�
SP_METHODS�is_monotonic_increasing)rJr[�kwargsrk�valids     r&�clean_interp_methodrr�s����J�J�w��E�
�)�)�e�m��R�S�S���#�E�
�U���1�%����x�z�R�S�S�
�;�;��,�,���(�N�O��
��Mr(c��|dvsJ�t|�dk(ry|jdk(r|jd��}|dk(r|ddj�}n*|dk(r%t|�dz
|ddd	�j�z
}|}|sy|S)
a+
    Retrieves the positional index of the first valid value.

    Parameters
    ----------
    how : {'first', 'last'}
        Use this parameter to change between the first or last valid index.
    is_valid: np.ndarray
        Mask to find na_values.

    Returns
    -------
    int or None
    )�first�lastrN����axisrtru���)r!�ndimr9�argmax)�how�is_valid�idxpos�	chk_notnas    r&�find_valid_indexr��s����#�#�#�#�
�8�}�����}�}����<�<�Q�<�'��
�g�~��"��$�$�&��	����X���"�X�d��d�^�%:�%:�%<�<���� �I����Mr(c�Z�gd�}|j�}||vrtd|�d|�d���|S)N)�forward�backward�bothz*Invalid limit_direction: expecting one of z, got 'z'.�rUr")�limit_direction�valid_limit_directionss  r&�validate_limit_directionr�sN��=��%�+�+�-�O��4�4��8�%�&�g�o�->�b�
B�
�	
��r(c�^�|�*ddg}|j�}||vrtd|�d|�d���|S)N�inside�outsidez%Invalid limit_area: expecting one of z, got �.r�)�
limit_area�valid_limit_areass  r&�validate_limit_arear�sV����%�y�1���%�%�'�
��.�.��7�8I�7J�&��,�a�!��
��r(c��|�|dvrd}|Sd}|S|dvr|dk7rtd|�d���|dvr|dk7rtd|�d���|S)N)rRrQr�r�)rPrOz0`limit_direction` must be 'forward' for method `�`z1`limit_direction` must be 'backward' for method `)r")r�rJs  r&�infer_limit_directionr�#s������*�*�(�O���(�O����%�%�/�Y�*F��B�6�(�!�L��
��*�*��*�/L��C�F�8�1�M��
��r(c��|dk(r+ddlm}|tjt	|���}nlhd�}t|j�xs<t|jt�xs tj|jd�}||vr|std|�d���t|�j�rtd��|S)	NrYrr>rZr[r\rS�mMz9Index column must be numeric or datetime type when using z_ method other than linear. Try setting a numeric or datetime index column before interpolating.zkInterpolation with NaNs in the index has not been implemented. Try filling those NaNs before interpolating.)�pandasrr.�aranger!rr*r-rr�is_np_dtyper"rr9�NotImplementedError)rJr[r�methods�is_numeric_or_datetimes     r&�get_interp_indexr�8s���
��� ��b�i�i��E�
�+�,��8���U�[�[�)�
2��%�+�+��7�
2����u�{�{�D�1�	�
�� �)?�����!!�!��
��E�{����!�
/�
�	
�
�Lr(c		�������	���t�|fi�	��t�|j�rt|jd����dk(r"t	|j�std��d�t
���t|��tjd����t|���d	���	�����fd�}
tj|
||�y)
z�
    Column-wise application of _interpolate_1d.

    Notes
    -----
    Alters 'data' in-place.

    The signature does differ from _interpolate_1d because it only
    includes what is needed for Block.interpolate.
    F)�compatrZzStime-weighted interpolation only works on Series or DataFrames with a DatetimeIndexr\N)�nobs�limitc
�0��td�|�����d�d�	���y)NF)	�indices�yvaluesrJr�r�r��
fill_value�bounds_errorr$rH)�_interpolate_1d)	r�r�r�rpr��limit_area_validatedr�r$rJs	 ��������r&�funcz$interpolate_2d_inplace.<locals>.func�s7���	�	
�����+�+�!���	
��	
r()r��
np.ndarray�return�None)
rrrr*rrr"r�r�r�validate_limit�_index_to_interp_indicesr.�apply_along_axis)
�datar[ryrJr�r�r�r�r$rpr�r�r�s
   ``` ``` @@r&�interpolate_2d_inplacer�Ws����.���0��0��Z����4�'��
�
�5�A�
�
���"�5�;�;�/�� ��
�
��.��?�O�.�z�:��
� � �d�%�8�E�&�u�f�5�G�
�
�,����d�D�)r(c�F�|j}t|j�r|jd�}|dk(r|}t	t
j|�}|Stj|�}|dvr2|jt
jk(rtj|�}|S)zE
    Convert Index to ndarray of indices to pass to NumPy/SciPy.
    �i8rY)r\r[)�_valuesrr*�viewrr.r7�asarray�object_r�maybe_convert_objects)r[rJ�xarr�indss    r&r�r��s����=�=�D��4�:�:�&��y�y����
������B�J�J��%���K�
�z�z�$����(�(��z�z�R�Z�Z�'��0�0��6���Kr(c
��|	�|	}nt|�}|}|j�sy|j�rytt	j
|��}
t
d|��}|�d}tt|��}t
d|��}|�t|�}ttd|zt|���}|dk(r|tt||d��z}n5|dk(r|tt|d|��z}ntt|||��}|d	k(r	|||zz}n|d
k(r
|
|z
|z
}||z}t|�}|jjdv}|r|jd�}|tvrBt	j||�}t	j ||||||||�||<nt#||||||f||||d
�|
��||<|	�d|	ddd|	|<y|rt$j&||<ytj(||<y)a
    Logic for the 1-d interpolation.  The input
    indices and yvalues will each be 1-d arrays of the same length.

    Bounds_error is currently hardcoded to False since non-scipy ones don't
    take it as an argument.

    Notes
    -----
    Fills 'yvalues' in-place.
    Nrt�r}r~rrurwr�r�r�r�r�r�)rJr�r�rkFT)rr9�all�setr.�flatnonzeror��ranger!�
_interp_limit�sortedr*�kindr�rm�argsort�interp�_interpolate_scipy_wrapperr
r#�nan)r�r�rJr�r�r�r�r�rkr$rp�invalidrq�all_nans�first_valid_index�
start_nans�last_valid_index�end_nans�
preserve_nans�mid_nans�is_datetimelike�indexers                      r&r�r��sK��0�����w�-��
�H�E��9�9�;���y�y�{���2�>�>�'�*�+�H�(�W�u�E��� ����U�,�-�.�J�'�F�U�C�����w�<���5��-�-�s�5�z�:�;�H��)�#�"�S��w��q�)I�%J�J�
�	�J�	&� �3�}�W�a��'G�#H�H�
��M�'�5�%�@�A�
��X����h�.�.�
�	�y�	 ��j�(�8�3����!�
��=�)�M��m�m�(�(�D�0�O���,�,�t�$��
����*�*�W�U�^�,���9�9��G��g�e�n�W�5�w�u�~�g�7N�
����6��E�N��E�N��G��	
��!�%��	
��	
��������Q��"��]��
�	
�!$����
���"$����
��
r(c��|�d�}td|��ddlm}	tj|�}|	j
|	jtttt|	jd�}
gd�}||vr*|dk(r|}n|}|	j|||||�	�}
|
|�}|S|d
k(r>t|�s|dkrtd|����|	j||fd|i|��}
|
|�}|S|jj s|j#�}|jj s|j#�}|jj s|j#�}|
|}
|
|||fi|��}|S)
z�
    Passed off to scipy.interpolate.interp1d. method is scipy's kind.
    Returns an array interpolated at new_x.  Add any new methods to
    the list in _clean_interp_method.
    z interpolation requires SciPy.�scipy)�extrar��interpolate)rarbrerfrirhrg)rSr]r^r_r`rdrd)r�r�r�rcz;order needs to be specified and greater than 0; got order: �k)rr�r�r.r��barycentric_interpolate�krogh_interpolate�_from_derivatives�_cubicspline_interpolate�_akima_interpolate�pchip_interpolate�interp1drr"�UnivariateSpline�flags�	writeabler+)rA�y�new_xrJr�r�rkrpr�r��alt_methods�interp1d_methodsr��terp�new_ys               r&r�r�%s}���h�4�5�E��w�e�4�!��J�J�u��E�#�:�:��.�.�-� 1�/�#��.�.��K����!�!��\�!��D��D��#�#�
�q�t�
��$�
���U���(�L�'
�8�	���;�5�A�:��M�e�W�U��
�,�{�+�+�A�q�D�E�D�V�D���U����L��w�w� � �����A��w�w� � �����A��{�{�$�$��J�J�L�E��6�"���Q��5�+�F�+���Lr(c��ddlm}|jj}|||j	dd�||��}||�S)a�
    Convenience function for interpolate.BPoly.from_derivatives.

    Construct a piecewise polynomial in the Bernstein basis, compatible
    with the specified values and derivatives at breakpoints.

    Parameters
    ----------
    xi : array-like
        sorted 1D array of x-coordinates
    yi : array-like or list of array-likes
        yi[i][j] is the j-th derivative known at xi[i]
    order: None or int or array-like of ints. Default: None.
        Specifies the degree of local polynomials. If not None, some
        derivatives are ignored.
    der : int or list
        How many derivatives to extract; None for all potentially nonzero
        derivatives (that is a number equal to the number of points), or a
        list of derivatives to extract. This number includes the function
        value as 0th derivative.
     extrapolate : bool, optional
        Whether to extrapolate to ouf-of-bounds points based on first and last
        intervals, or to return NaNs. Default: True.

    See Also
    --------
    scipy.interpolate.BPoly.from_derivatives

    Returns
    -------
    y : scalar or array-like
        The result, of length R or length M or M by R.
    rr�rzrw)�orders�extrapolate)r�r��BPolyre�reshape)	�xi�yirArk�derr�r�rJ�ms	         r&r�r�ls?��R"��
�
�
/�
/�F��r�2�:�:�b�!�$�U��L�A��Q�4�Kr(c�J�ddlm}|j|||��}|||��S)aQ
    Convenience function for akima interpolation.
    xi and yi are arrays of values used to approximate some function f,
    with ``yi = f(xi)``.

    See `Akima1DInterpolator` for details.

    Parameters
    ----------
    xi : np.ndarray
        A sorted list of x-coordinates, of length N.
    yi : np.ndarray
        A 1-D array of real values.  `yi`'s length along the interpolation
        axis must be equal to the length of `xi`. If N-D array, use axis
        parameter to select correct axis.
    x : np.ndarray
        Of length M.
    der : int, optional
        How many derivatives to extract; None for all potentially
        nonzero derivatives (that is a number equal to the number
        of points), or a list of derivatives to extract. This number
        includes the function value as 0th derivative.
    axis : int, optional
        Axis in the yi array corresponding to the x-coordinate values.

    See Also
    --------
    scipy.interpolate.Akima1DInterpolator

    Returns
    -------
    y : scalar or array-like
        The result, of length R or length M or M by R,

    rr�rx)�nu)r�r��Akima1DInterpolator)r�r�rAr�ryr��Ps       r&r�r��s+��T"��'�'��B�T�'�:�A��Q�3�<�r(c�J�ddlm}|j|||||��}||�S)ag

    Convenience function for cubic spline data interpolator.

    See `scipy.interpolate.CubicSpline` for details.

    Parameters
    ----------
    xi : np.ndarray, shape (n,)
        1-d array containing values of the independent variable.
        Values must be real, finite and in strictly increasing order.
    yi : np.ndarray
        Array containing values of the dependent variable. It can have
        arbitrary number of dimensions, but the length along ``axis``
        (see below) must match the length of ``x``. Values must be finite.
    x : np.ndarray, shape (m,)
    axis : int, optional
        Axis along which `y` is assumed to be varying. Meaning that for
        ``x[i]`` the corresponding values are ``np.take(y, i, axis=axis)``.
        Default is 0.
    bc_type : string or 2-tuple, optional
        Boundary condition type. Two additional equations, given by the
        boundary conditions, are required to determine all coefficients of
        polynomials on each segment [2]_.
        If `bc_type` is a string, then the specified condition will be applied
        at both ends of a spline. Available conditions are:
        * 'not-a-knot' (default): The first and second segment at a curve end
          are the same polynomial. It is a good default when there is no
          information on boundary conditions.
        * 'periodic': The interpolated functions is assumed to be periodic
          of period ``x[-1] - x[0]``. The first and last value of `y` must be
          identical: ``y[0] == y[-1]``. This boundary condition will result in
          ``y'[0] == y'[-1]`` and ``y''[0] == y''[-1]``.
        * 'clamped': The first derivative at curves ends are zero. Assuming
          a 1D `y`, ``bc_type=((1, 0.0), (1, 0.0))`` is the same condition.
        * 'natural': The second derivative at curve ends are zero. Assuming
          a 1D `y`, ``bc_type=((2, 0.0), (2, 0.0))`` is the same condition.
        If `bc_type` is a 2-tuple, the first and the second value will be
        applied at the curve start and end respectively. The tuple values can
        be one of the previously mentioned strings (except 'periodic') or a
        tuple `(order, deriv_values)` allowing to specify arbitrary
        derivatives at curve ends:
        * `order`: the derivative order, 1 or 2.
        * `deriv_value`: array-like containing derivative values, shape must
          be the same as `y`, excluding ``axis`` dimension. For example, if
          `y` is 1D, then `deriv_value` must be a scalar. If `y` is 3D with
          the shape (n0, n1, n2) and axis=2, then `deriv_value` must be 2D
          and have the shape (n0, n1).
    extrapolate : {bool, 'periodic', None}, optional
        If bool, determines whether to extrapolate to out-of-bounds points
        based on first and last intervals, or to return NaNs. If 'periodic',
        periodic extrapolation is used. If None (default), ``extrapolate`` is
        set to 'periodic' for ``bc_type='periodic'`` and to True otherwise.

    See Also
    --------
    scipy.interpolate.CubicHermiteSpline

    Returns
    -------
    y : scalar or array-like
        The result, of shape (m,)

    References
    ----------
    .. [1] `Cubic Spline Interpolation
            <https://en.wikiversity.org/wiki/Cubic_Spline_Interpolation>`_
            on Wikiversity.
    .. [2] Carl de Boor, "A Practical Guide to Splines", Springer-Verlag, 1978.
    rr�)ry�bc_typer�)r�r��CubicSpline)r�r�rAryr�r�r�r�s        r&r�r��s3��Z"����
�B�T�7��	 �	�A�
�Q�4�Kr(c�4�t|�}|}|j�sztd|��}|�d}td|��}|�t|�}t	||||��|dk(r	d|||d	zn|d
k(rdx|d|||d	zdntd��tj||<yy)a�
    Apply interpolation and limit_area logic to values along a to-be-specified axis.

    Parameters
    ----------
    values: np.ndarray
        Input array.
    method: str
        Interpolation method. Could be "bfill" or "pad"
    limit: int, optional
        Index limit on interpolation.
    limit_area: {'inside', 'outside'}
        Limit area for interpolation.

    Notes
    -----
    Modifies values in-place.
    rtr�Nrru)rJr�r�r�Frwr�z*limit_area should be 'inside' or 'outside')rr�r�r!�pad_or_backfill_inplacer"r.r�)r\rJr�r�r�r~rtrus        r&�_interpolate_with_limit_arear�%s���2�6�l�G��x�H��;�;�=� �W�x�@���=��E��F�X�>���<��v�;�D�����!�		
���!�(-�G�E�D�1�H�%�
�9�
$�49�9�G�F�U�O�g�d�Q�h�j�1��I�J�J��&�&��w��-r(c��|dk(rd�nd�}|jdk(r7|dk7rtd��|jtd|jz��}t|�}||�}t
|d��}||||�	�y
)a
    Perform an actual interpolation of values, values will be make 2-d if
    needed fills inplace, returns the result.

    Parameters
    ----------
    values: np.ndarray
        Input array.
    method: str, default "pad"
        Interpolation method. Could be "bfill" or "pad"
    axis: 0 or 1
        Interpolation axis
    limit: int, optional
        Index limit on interpolation.
    limit_area: str, optional
        Limit area for interpolation. Can be "inside" or "outside"

    Notes
    -----
    Modifies values in-place.
    rc��|SrGrH�rAs r&�<lambda>z)pad_or_backfill_inplace.<locals>.<lambda>vs��r(c��|jSrG)�Tr�s r&r�z)pad_or_backfill_inplace.<locals>.<lambda>vs����r(rwz0cannot interpolate on a ndim == 1 with axis != 0�rwrv)r{)r�r�N)r{�AssertionErrorr��tupler4rK�
get_fill_func)r\rJryr�r��transf�tvaluesr�s        r&r�r�Zsy��8#�a�i�k�m�F��{�{�a���1�9� �!S�T�T�����d�V�\�\�&9� :�;��
�v�
&�F��V�n�G���a�(�D����*�5r(c� �|�t|�}|SrG)r)r\r$s  r&�_fillna_prepr�s��
�|��F�|���Kr(c�Z��t��			d			d�fd�
�}tt|�S)z>
    Wrapper to handle datetime64 and timedelta64 dtypes.
    c����t|j�rH|�t|�}�|jd�|||��\}}|j|j�|fS�||||��S)Nr�)r�r�r$)rr*rr�)r\r�r�r$�resultr�s     �r&�new_funcz&_datetimelike_compat.<locals>.new_func�sj����v�|�|�,��|��F�|������D�!��:�D��L�F�D��;�;�v�|�|�,�d�2�2��F�%�J�T�J�Jr(�NNN)r��
int | Noner��#Literal['inside', 'outside'] | None)rrr)r�rs` r&�_datetimelike_compatr�sK���
�4�[�!�:>�
�	K��K�8�K��K�$��8��r(c��t||�}|�|j�st||�tj|||��||fS�N)r�)rr��_fill_limit_area_1dr�pad_inplace�r\r�r�r$s    r&�_pad_1dr�sD�����%�D���d�h�h�j��D�*�-�	���f�d�%�0��4�<�r(c��t||�}|�|j�st||�tj|||��||fSr)rr�rr�backfill_inplacers    r&�_backfill_1dr�sD�����%�D���d�h�h�j��D�*�-�	���6�4�u�5��4�<�r(c��t||�}|�t||�|jrtj|||��||fS	||fSr)r�_fill_limit_area_2d�sizer�pad_2d_inplacers    r&�_pad_2dr�sT�����%�D����D�*�-�
�{�{�
���V�T��7��4�<��	
��4�<�r(c��t||�}|�t||�|jrtj|||��||fS	||fSr)rrrr�backfill_2d_inplacers    r&�_backfill_2dr �sT�����%�D����D�*�-�
�{�{�
�!�!�&�$�e�<��4�<��	
��4�<�r(c��|}|j�}t|�|ddd�j�z
dz
}|dk(rd|d|d||dzdy|dk(r	d||dz|yy)a�Prepare 1d mask for ffill/bfill with limit_area.

    Caller is responsible for checking at least one value of mask is False.
    When called, mask will no longer faithfully represent when
    the corresponding are NA or not.

    Parameters
    ----------
    mask : np.ndarray[bool, ndim=1]
        Mask representing NA values when filling.
    limit_area : { "outside", "inside" }
        Whether to limit filling to outside or inside the outer most non-NA value.
    Nrzrwr�Fr�)r|r!)r$r��neg_maskrtrus     r&rr�s{�� �u�H��O�O��E��x�=�8�D�b�D�>�0�0�2�2�Q�6�D��X����V�e�� ��T�A�X�Z��	�y�	 �!&��U�Q�Y���
!r(c��|j}|dk(rPtjj|d��tjj|ddd�d��ddd�z}nQtjj|d��tjj|ddd�d��ddd�z}d||j<y)a�Prepare 2d mask for ffill/bfill with limit_area.

    When called, mask will no longer faithfully represent when
    the corresponding are NA or not.

    Parameters
    ----------
    mask : np.ndarray[bool, ndim=1]
        Mask representing NA values when filling.
    limit_area : { "outside", "inside" }
        Whether to limit filling to outside or inside the outer most non-NA value.
    r�rrxNrzF)r�r.�maximum�
accumulate)r$r�r"�la_masks    r&rrs������w�H��Y��
�J�J�!�!�(��!�3��j�j�#�#�H�T�r�T�N��#�;�D�b�D�A�
B�	��Z�Z�
"�
"�8�!�
"�
4�4��z�z�$�$�X�d��d�^�!�$�<�T�r�T�B�B�
C�	��D����Or(�rPrRc�T�t|�}|dk(r	t|Sttd�|S)Nrwr')rK�
_fill_methodsrr )rJr{s  r&rr*s.��
�v�
&�F��q�y��V�$�$���5�f�=�=r(c�"�|�yt|d��S)NTrD)rK)rJs r&�clean_reindex_fill_methodr+1s��
�~���V�4�8�8r(c�T��t|��t�}t�}d�fd�}|�0|dk(r"ttj|�d�}n	|||�}|�J|dk(r|St	||ddd�|��}t�dz
tj
|�z
�}|dk(r|S||zS)ak
    Get indexers of values that won't be filled
    because they exceed the limits.

    Parameters
    ----------
    invalid : np.ndarray[bool]
    fw_limit : int or None
        forward limit to index
    bw_limit : int or None
        backward limit to index

    Returns
    -------
    set of indexers

    Notes
    -----
    This is equivalent to the more readable, but slower

    .. code-block:: python

        def _interp_limit(invalid, fw_limit, bw_limit):
            for x in np.where(invalid)[0]:
                if invalid[max(0, x - fw_limit):x + bw_limit + 1].all():
                    yield x
    c	���t|��}t||dz�jd�}tt	j
|�d|z�tt	j
|d|dzj
�dk(�d�z}|S)Nrwr)�min�_rolling_windowr�r�r.�where�cumsum)r�r��windowed�idx�Ns    �r&�innerz_interp_limit.<locals>.inner\s�����E�1�
��"�7�E�A�I�6�:�:�1�=���"�(�(�8�$�Q�'�%�/�0�3��H�H�w�{����+�+�3�3�5��:�;�A�>�4
�
���
r(Nrrzrw)r��int)r!r�r.r0�listr�)r��fw_limit�bw_limit�f_idx�b_idxr5�	b_idx_invr4s       @r&r�r�7s����B	�G��A��E�E��E�E�����q�=������)�!�,�-�E��'�8�,�E����q�=��L��U�7�4�R�4�=�(�;�<�I���A���
�
�9� 5�5�6�E��1�}����5�=�r(c���|jdd|jd|z
dz|fz}|j|jdfz}tjjj|||��S)z�
    [True, True, False, True, False], 2 ->

    [
        [True,  True],
        [True, False],
        [False, True],
        [True, False],
    ]
    Nrzrw)r4�strides)r4r>r.r�
stride_tricks�
as_strided)�a�windowr4r>s    r&r/r/xsj��
�G�G�C�R�L�A�G�G�B�K�&�0�1�4�f�=�=�E��i�i�1�9�9�R�=�*�*�G�
�6�6���*�*�1�E�7�*�K�Kr()r$�npt.NDArray[np.bool_]r%r6)r:r
r�rC)rJz,Literal['ffill', 'pad', 'bfill', 'backfill']rEzLiteral[False]r��Literal['pad', 'backfill'])rJ�7Literal['ffill', 'pad', 'bfill', 'backfill', 'nearest']rEz
Literal[True]r��%Literal['pad', 'backfill', 'nearest'])rJrErEr5r�rF)rJrTr[rr�rT)r}rTr~rCr�r
)r�rTr�z&Literal['forward', 'backward', 'both'])r��
str | Noner�r)r�z-Literal['backward', 'forward', 'both'] | NonerJrTr�z&Literal['backward', 'forward', 'both'])r[rr�r)rYNr�NNN)r�r�r[rryrrJrTr�r
r�rTr�rGr��
Any | Noner�r�)r[rrJrTr�r�)rYNr�NNFNN)r�r�r�r�rJrTr�r
r�rTr�rr�rHr�r5rkr
r�r�)NFN)
rAr�r�r�r�r�rJrTr�r5)NrF)
r�r�r�r�rAr�r��int | list[int] | Noner�r5)rr)
r�r�r�r�rAr�r�rIryr)rz
not-a-knotN)
r�r�r�r�rAr�ryrr�zstr | tuple[Any, Any])
r\r�rJrDr�r
r�zLiteral['inside', 'outside']r�r�)rPrNN)r\r�rJrDryrr�r
r�rr�r�rG)r$�npt.NDArray[np.bool_] | Noner�rC)r�rr�rr)
r\r�r�r
r�rr$rJr�z(tuple[np.ndarray, npt.NDArray[np.bool_]])r\r�r�r
r�rr$rJ)r�r
r�rr$rJ)r$rCr�zLiteral['outside', 'inside']r�r�r)r{r6)r�zReindexMethod | None)r�rCr8r
r9r
)rArCrBr6r�rC)K�__doc__�
__future__r�	functoolsr�typingrrrrr	�numpyr.�pandas._libsr
rr�pandas._typingr
rrrr�pandas.compat._optionalr�pandas.core.dtypes.castr�pandas.core.dtypes.commonrrrrrr�pandas.core.dtypes.dtypesr�pandas.core.dtypes.missingrrrr�rr'rCrKrmrnrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrrr rrr)rr+r�r/rHr(r&�<module>rWs����#�������
��?�4���6������F�R
�%(��8��"�� �	�
��
��C��!��+�	�
�� ��C����+�	�43�
��
�$�&#�L���+����B��LO��+��*�F��$�!�!�	
�C*�
�C*��C*��C*�
�	C*�
�C*��
C*��C*��C*�
�C*�L�2��$�6:�!���	
�o�
�o�
�o�
�o��	o�
�o�4�
o��o��o��o�
�o�n��
�D��D��D��D�
�	D��
D�V�"#��
/��/��/��/�

 �/��
/�l#$��.��.��.��.�
 �	.�
�.�j�%1��
S��S��S��S��	S�
#�S�l2!��2!�&�2!��2!�-�	2!�

�2!�n*/���6:�)6��)6�&�)6��)6��	)6�
4�)6�
�
)6�Z26��.�����6��6:�)-�	
��
��
�4�
�'�	
�
.�
��
���6:�)-�	
��
��
�4�
�'�	
�
.�
��
���6:�)-�	�����4��'�	���$��6:�)-�	���4��'�	���$'�
�'�-I�'�	�'�4�
��-I��	��> �\�:�
�>�9�>�
"�>�.8�>�DN�>�BLr(

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