403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/pandas/core/window/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/pandas/core/window/__pycache__/expanding.cpython-312.pyc
�

.	�g�l���ddlmZddlmZddlmZmZmZmZddl	m
Z
mZddlm
Z
mZmZddlmZmZmZmZmZmZmZmZmZddlmZmZerddlmZmZm Z dd	l!m"Z"m#Z#dd
l$m%Z%Gd�de�Z&Gd
�dee&�Z'y)�)�annotations)�dedent)�
TYPE_CHECKING�Any�Callable�Literal)�deprecate_kwarg�doc)�BaseIndexer�ExpandingIndexer�GroupbyIndexer)	�_shared_docs�create_section_header�kwargs_numeric_only�numba_notes�template_header�template_returns�template_see_also�window_agg_numba_parameters�window_apply_parameters)�BaseWindowGroupby�RollingAndExpandingMixin)�Axis�QuantileInterpolation�WindowingRankType)�	DataFrame�Series)�NDFramec����eZdZUdZgd�Zded<				df									dg�fd�
Zdhd�Zee	de
d	�e
d
�dd�
��fd��ZeZee
ed�eed�eed�e
d�ddd��
didj�fd�
�Zee
ed�eed�eed�eed�e
d�ddd��					dk											dl�fd�
�Zee
ed�ee�ed�eed�eed�eed�e
d�ddd��			dm					dn�fd �
�Zee
ed�ee�ed�eed�eed�eed�e
d!�dd"d#��			dm					dn�fd$�
�Zee
ed�ee�ed�eed�eed�eed�e
d%�dd&d'��			dm					dn�fd(�
�Zee
ed�ee�ed�eed�eed�eed�e
d)�dd*d*��			dm					dn�fd+�
�Zee
ed�ee�ed�eed�eed�eed�e
d,�dd-d-��			dm					dn�fd.�
�Zee
ed�e
d/�j9d0dd�eed1�ed�eed�d2eed�e
d3�j9d0dd�ed�e
d4�j9d0dd�dd5d6��				do							dp�fd7�
�Zee
ed�e
d/�j9d0dd�eed1�ed�eed�d8eed�e
d9�j9d0dd�ed�e
d:�j9d0dd�dd;d<��				do							dp�fd=�
�Zee
ed�e
d/�j9d0dd�eed�eed�eed�d>ed�e
d?�j9d0dd�dd@dA��dqdr�fdB�
�Zee
ed�eed�eed�dCeed�dDed�e
dE�ddFdG��didj�fdH�
�Z ee
ed�eed�eed�dIeed�dJed�e
dK�j9d0dd�ddLdM��didj�fdN�
�Z!ee
ed�e
dO�j9d0dd�eed�eed�eed�e
dP�ddQdQ��
e"dQdR�S�		ds					dt�fdT�
��Z#ee
dUed�e
dV�j9d0dd�eed�eed�eed�e
dW�j9d0dd�ddXdX��				du							dv�fdY�
�Z$ee
ed�e
dZ�j9d0dd�eed�eed�eed�e
d[�dd\d]��
				dw							dx�fd^�
�Z%ee
ed�e
d_�j9d0dd�eed�eed�e
d`�j9d0dd�eed�e
da�ed�e
db�ddcdd��				dw							dx�fde�
�Z&�xZ'S)y�	Expandinga�
    Provide expanding window calculations.

    Parameters
    ----------
    min_periods : int, default 1
        Minimum number of observations in window required to have a value;
        otherwise, result is ``np.nan``.

    axis : int or str, default 0
        If ``0`` or ``'index'``, roll across the rows.

        If ``1`` or ``'columns'``, roll across the columns.

        For `Series` this parameter is unused and defaults to 0.

    method : str {'single', 'table'}, default 'single'
        Execute the rolling operation per single column or row (``'single'``)
        or over the entire object (``'table'``).

        This argument is only implemented when specifying ``engine='numba'``
        in the method call.

        .. versionadded:: 1.3.0

    Returns
    -------
    pandas.api.typing.Expanding

    See Also
    --------
    rolling : Provides rolling window calculations.
    ewm : Provides exponential weighted functions.

    Notes
    -----
    See :ref:`Windowing Operations <window.expanding>` for further usage details
    and examples.

    Examples
    --------
    >>> df = pd.DataFrame({"B": [0, 1, 2, np.nan, 4]})
    >>> df
         B
    0  0.0
    1  1.0
    2  2.0
    3  NaN
    4  4.0

    **min_periods**

    Expanding sum with 1 vs 3 observations needed to calculate a value.

    >>> df.expanding(1).sum()
         B
    0  0.0
    1  1.0
    2  3.0
    3  3.0
    4  7.0
    >>> df.expanding(3).sum()
         B
    0  NaN
    1  NaN
    2  3.0
    3  3.0
    4  7.0
    )�min_periods�axis�methodz	list[str]�_attributes�c�.��t�|�|||||��y)N)�objr!r"r#�	selection)�super�__init__)�selfr'r!r"r#r(�	__class__s      ��>C:\Python312\Lib\site-packages\pandas/core/window/expanding.pyr*zExpanding.__init__|s&���	����#����	�	
�c��t�S)z[
        Return an indexer class that will compute the window start and end bounds
        )r)r+s r-�_get_window_indexerzExpanding._get_window_indexer�s
�� �!�!r.�	aggregatez�
        See Also
        --------
        pandas.DataFrame.aggregate : Similar DataFrame method.
        pandas.Series.aggregate : Similar Series method.
        a�
        Examples
        --------
        >>> df = pd.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6], "C": [7, 8, 9]})
        >>> df
           A  B  C
        0  1  4  7
        1  2  5  8
        2  3  6  9

        >>> df.ewm(alpha=0.5).mean()
                  A         B         C
        0  1.000000  4.000000  7.000000
        1  1.666667  4.666667  7.666667
        2  2.428571  5.428571  8.428571
        zSeries/Dataframe�)�see_also�examples�klassr"c�*��t�|�|g|��i|��S)N)r)r1)r+�func�args�kwargsr,s    �r-r1zExpanding.aggregate�s ���@�w� ��7��7��7�7r.�ReturnszSee Also�Examplesz�        >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().count()
        a    1.0
        b    2.0
        c    3.0
        d    4.0
        dtype: float64
        �	expandingzcount of non NaN observations�count)�
window_method�aggregation_description�
agg_methodc�$��t�|�|��S�N)�numeric_only)r)r=�r+rCr,s  �r-r=zExpanding.count�s���.�w�}�,�}�7�7r.�
Parametersz�        >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().apply(lambda s: s.max() - 2 * s.min())
        a   -1.0
        b    0.0
        c    1.0
        d    2.0
        dtype: float64
        zcustom aggregation function�applyc�.��t�|�||||||��S)N)�raw�engine�
engine_kwargsr8r9)r)rF)r+r7rHrIrJr8r9r,s       �r-rFzExpanding.apply�s.���B�w�}����'���
�
�	
r.�Notesz�        >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().sum()
        a     1.0
        b     3.0
        c     6.0
        d    10.0
        dtype: float64
        �sumc�(��t�|�|||��S�N)rCrIrJ)r)rL�r+rCrIrJr,s    �r-rLz
Expanding.sum��%���B�w�{�%��'��
�	
r.z�        >>> ser = pd.Series([3, 2, 1, 4], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().max()
        a    3.0
        b    3.0
        c    3.0
        d    4.0
        dtype: float64
        �maximum�maxc�(��t�|�|||��SrN)r)rRrOs    �r-rRz
Expanding.max rPr.z�        >>> ser = pd.Series([2, 3, 4, 1], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().min()
        a    2.0
        b    2.0
        c    2.0
        d    1.0
        dtype: float64
        �minimum�minc�(��t�|�|||��SrN)r)rUrOs    �r-rUz
Expanding.minGrPr.z�        >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().mean()
        a    1.0
        b    1.5
        c    2.0
        d    2.5
        dtype: float64
        �meanc�(��t�|�|||��SrN)r)rWrOs    �r-rWzExpanding.meanns%���B�w�|�%��'��
�	
r.z�        >>> ser = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser.expanding().median()
        a    1.0
        b    1.5
        c    2.0
        d    2.5
        dtype: float64
        �medianc�(��t�|�|||��SrN)r)rYrOs    �r-rYzExpanding.median�s%���B�w�~�%��'��
�	
r.z�
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.

        �
z1.4z/numpy.std : Equivalent method for NumPy array.
z�
        The default ``ddof`` of 1 used in :meth:`Series.std` is different
        than the default ``ddof`` of 0 in :func:`numpy.std`.

        A minimum of one period is required for the rolling calculation.

        a

        >>> s = pd.Series([5, 5, 6, 7, 5, 5, 5])

        >>> s.expanding(3).std()
        0         NaN
        1         NaN
        2    0.577350
        3    0.957427
        4    0.894427
        5    0.836660
        6    0.786796
        dtype: float64
        zstandard deviation�stdc�*��t�|�||||��S�N)�ddofrCrIrJ)r)r\�r+r_rCrIrJr,s     �r-r\z
Expanding.std��(���j�w�{��%��'�	�
�	
r.z/numpy.var : Equivalent method for NumPy array.
z�
        The default ``ddof`` of 1 used in :meth:`Series.var` is different
        than the default ``ddof`` of 0 in :func:`numpy.var`.

        A minimum of one period is required for the rolling calculation.

        a

        >>> s = pd.Series([5, 5, 6, 7, 5, 5, 5])

        >>> s.expanding(3).var()
        0         NaN
        1         NaN
        2    0.333333
        3    0.916667
        4    0.800000
        5    0.700000
        6    0.619048
        dtype: float64
        �variance�varc�*��t�|�||||��Sr^)r)rcr`s     �r-rcz
Expanding.var�rar.z:A minimum of one period is required for the calculation.

z�
        >>> s = pd.Series([0, 1, 2, 3])

        >>> s.expanding().sem()
        0         NaN
        1    0.707107
        2    0.707107
        3    0.745356
        dtype: float64
        zstandard error of mean�semc�&��t�|�||��S)N)r_rC)r)re)r+r_rCr,s   �r-rez
Expanding.sem4s���F�w�{��<�{�@�@r.z:scipy.stats.skew : Third moment of a probability density.
zEA minimum of three periods is required for the rolling calculation.

a        >>> ser = pd.Series([-1, 0, 2, -1, 2], index=['a', 'b', 'c', 'd', 'e'])
        >>> ser.expanding().skew()
        a         NaN
        b         NaN
        c    0.935220
        d    1.414214
        e    0.315356
        dtype: float64
        zunbiased skewness�skewc�$��t�|�|��SrB)r)rgrDs  �r-rgzExpanding.skewYs���:�w�|��|�6�6r.z/scipy.stats.kurtosis : Reference SciPy method.
z<A minimum of four periods is required for the calculation.

a[
        The example below will show a rolling calculation with a window size of
        four matching the equivalent function call using `scipy.stats`.

        >>> arr = [1, 2, 3, 4, 999]
        >>> import scipy.stats
        >>> print(f"{{scipy.stats.kurtosis(arr[:-1], bias=False):.6f}}")
        -1.200000
        >>> print(f"{{scipy.stats.kurtosis(arr, bias=False):.6f}}")
        4.999874
        >>> s = pd.Series(arr)
        >>> s.expanding(4).kurt()
        0         NaN
        1         NaN
        2         NaN
        3   -1.200000
        4    4.999874
        dtype: float64
        z,Fisher's definition of kurtosis without bias�kurtc�$��t�|�|��SrB)r)rirDs  �r-rizExpanding.kurtxs���L�w�|��|�6�6r.a�
        quantile : float
            Quantile to compute. 0 <= quantile <= 1.

            .. deprecated:: 2.1.0
                This will be renamed to 'q' in a future version.
        interpolation : {{'linear', 'lower', 'higher', 'midpoint', 'nearest'}}
            This optional parameter specifies the interpolation method to use,
            when the desired quantile lies between two data points `i` and `j`:

                * linear: `i + (j - i) * fraction`, where `fraction` is the
                  fractional part of the index surrounded by `i` and `j`.
                * lower: `i`.
                * higher: `j`.
                * nearest: `i` or `j` whichever is nearest.
                * midpoint: (`i` + `j`) / 2.
        a        >>> ser = pd.Series([1, 2, 3, 4, 5, 6], index=['a', 'b', 'c', 'd', 'e', 'f'])
        >>> ser.expanding(min_periods=4).quantile(.25)
        a     NaN
        b     NaN
        c     NaN
        d    1.75
        e    2.00
        f    2.25
        dtype: float64
        �quantile�q)�old_arg_name�new_arg_namec�(��t�|�|||��S)N)rl�
interpolationrC)r)rk)r+rlrprCr,s    �r-rkzExpanding.quantile�s&���h�w���'�%� �
�	
r.z.. versionadded:: 1.4.0 

a
        method : {{'average', 'min', 'max'}}, default 'average'
            How to rank the group of records that have the same value (i.e. ties):

            * average: average rank of the group
            * min: lowest rank in the group
            * max: highest rank in the group

        ascending : bool, default True
            Whether or not the elements should be ranked in ascending order.
        pct : bool, default False
            Whether or not to display the returned rankings in percentile
            form.
        a+
        >>> s = pd.Series([1, 4, 2, 3, 5, 3])
        >>> s.expanding().rank()
        0    1.0
        1    2.0
        2    2.0
        3    3.0
        4    5.0
        5    3.5
        dtype: float64

        >>> s.expanding().rank(method="max")
        0    1.0
        1    2.0
        2    2.0
        3    3.0
        4    5.0
        5    4.0
        dtype: float64

        >>> s.expanding().rank(method="min")
        0    1.0
        1    2.0
        2    2.0
        3    3.0
        4    5.0
        5    3.0
        dtype: float64
        �rankc�*��t�|�||||��S)N)r#�	ascending�pctrC)r)rq)r+r#rsrtrCr,s     �r-rqzExpanding.rank�s(���H�w�|����%�	�
�	
r.a
        other : Series or DataFrame, optional
            If not supplied then will default to self and produce pairwise
            output.
        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndexed DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.
        ddof : int, default 1
            Delta Degrees of Freedom.  The divisor used in calculations
            is ``N - ddof``, where ``N`` represents the number of elements.
        a0        >>> ser1 = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser2 = pd.Series([10, 11, 13, 16], index=['a', 'b', 'c', 'd'])
        >>> ser1.expanding().cov(ser2)
        a         NaN
        b    0.500000
        c    1.500000
        d    3.333333
        dtype: float64
        zsample covariance�covc�*��t�|�||||��S�N)�other�pairwiser_rC)r)ru�r+rxryr_rCr,s     �r-ruz
Expanding.cov%s(���b�w�{����%�	�
�	
r.aN
        other : Series or DataFrame, optional
            If not supplied then will default to self and produce pairwise
            output.
        pairwise : bool, default None
            If False then only matching columns between self and other will be
            used and the output will be a DataFrame.
            If True then all pairwise combinations will be calculated and the
            output will be a MultiIndexed DataFrame in the case of DataFrame
            inputs. In the case of missing elements, only complete pairwise
            observations will be used.
        z�
        cov : Similar method to calculate covariance.
        numpy.corrcoef : NumPy Pearson's correlation calculation.
        ao
        This function uses Pearson's definition of correlation
        (https://en.wikipedia.org/wiki/Pearson_correlation_coefficient).

        When `other` is not specified, the output will be self correlation (e.g.
        all 1's), except for :class:`~pandas.DataFrame` inputs with `pairwise`
        set to `True`.

        Function will return ``NaN`` for correlations of equal valued sequences;
        this is the result of a 0/0 division error.

        When `pairwise` is set to `False`, only matching columns between `self` and
        `other` will be used.

        When `pairwise` is set to `True`, the output will be a MultiIndex DataFrame
        with the original index on the first level, and the `other` DataFrame
        columns on the second level.

        In the case of missing elements, only complete pairwise observations
        will be used.

        a1        >>> ser1 = pd.Series([1, 2, 3, 4], index=['a', 'b', 'c', 'd'])
        >>> ser2 = pd.Series([10, 11, 13, 16], index=['a', 'b', 'c', 'd'])
        >>> ser1.expanding().corr(ser2)
        a         NaN
        b    1.000000
        c    0.981981
        d    0.975900
        dtype: float64
        �correlation�corrc�*��t�|�||||��Srw)r)r|rzs     �r-r|zExpanding.corr]s(���X�w�|����%�	�
�	
r.)r%r�singleN)
r'rr!�intr"rr#�str�return�None)r�r)F)rC�bool)FNNNN)r7zCallable[..., Any]rHr�rI�!Literal['cython', 'numba'] | NonerJ�dict[str, bool] | Noner8ztuple[Any, ...] | Noner9zdict[str, Any] | None)FNN)rCr�rIr�rJr�)r%FNN)r_rrCr�rIr�rJr�)r%F)r_rrCr�)�linearF)rl�floatrprrCr�)�averageTFF)r#rrsr�rtr�rCr�)NNr%F)rxzDataFrame | Series | Noneryzbool | Noner_rrCr�)(�__name__�
__module__�__qualname__�__doc__r$�__annotations__r*r0r
rrr1�aggrrrrr=rrFrrrrLrRrUrWrY�replacer\rcrergrir	rkrqrur|�
__classcell__)r,s@r-r r 3s�
���D�L?�K��>�
����

�
�
��
��	
�
�
�
�
� "�	��[�!��
�
��
�
�$!�
�;�>8�?�>8��C����i�(���j�)���j�)��
�
	
�"� ?��)�,8�-�,8�	���l�+���i�(���j�)���j�)��
�
	
�"� =��-�6�48�04�'+�(,�
� �
��
�2�	
�
.�
�%�

�&�
�1�0
�$	���l�+��#�%��i�(���j�)���g�&���j�)��
�
	
�"� %��3�:#�48�04�	

��

�2�

�.�	

�7�6

�	���l�+��#�%��i�(���j�)���g�&���j�)��
�
	
�"� )��3�:#�48�04�	

��

�2�

�.�	

�7�6

�	���l�+��#�%��i�(���j�)���g�&���j�)��
�
	
�"� )��3�:#�48�04�	

��

�2�

�.�	

�7�6

�	���l�+��#�%��i�(���j�)���g�&���j�)��
�
	
�"� &��3�:#�48�04�	

��

�2�

�.�	

�7�6

�	���l�+��#�%��i�(���j�)���g�&���j�)��
�
	
�"� (��3�:#�48�04�	

��

�2�

�.�	

�7�6

�	���l�+��
�	
��'�$��A�
��#�E�*��i�(���j�)�:���g�&��
�	
��'�$��A�
��j�)��
�	
��'�$��A�
�!� 4��Y-�`�"�48�04�
��
��
�2�	
�
.�
�]-�\
�	���l�+��
�	
��'�$��A�
��#�E�*��i�(���j�)�:���g�&��
�	
��'�$��A�
��j�)��
�	
��'�$��A�
�!� *��Y-�`�"�48�04�
��
��
�2�	
�
.�
�]-�\
�	���l�+��
�	
��'�$��A�
���i�(���j�)���g�&�F��j�)��	
�	
��'�$��A�
�!� 8��A!�DA�E!�DA�	���l�+���i�(���j�)�E���g�&�Q��j�)��	
�	
�"� 3��5�87�9�87�	���l�+���i�(���j�)�:���g�&�H��j�)��
�	
�(�'�$��A�
�!� N��G$�J7�K$�J7�	���l�+��
�	
�$�'�$��A�
���i�(���j�)���j�)��

�	
�"� *��W,�Z�*�3�?�08�"�	

��

�-�

��	

�@�[,�\

�	��&��l�+��

�	
��'�$��A�
���i�(���j�)���j�)��
�	
�<�'�$��A�
�!� &��w<�~%.���"�
�!�
��
��	
�
�
�{<�z
�	���l�+��
�	
� �'�$��A�
���i�(���j�)���j�)��	
�	
�"� 3��Q)�X,0� $��"�
�(�
��
��	
�
�
�U)�T
�	���l�+��
�
	
��'�$��A�
���i�(���j�)��
�	
�
�'�$��A�
���g�&��
�	
�.	�j�)��	
�	
�"� -��GD�N,0� $��"�
�(�
��
��	
�
�
�KD�J
r.r c�J�eZdZdZej
ej
zZdd�Zy)�ExpandingGroupbyz5
    Provide a expanding groupby implementation.
    c�P�t|jjt��}|S)z�
        Return an indexer class that will compute the window start and end bounds

        Returns
        -------
        GroupbyIndexer
        )�groupby_indices�window_indexer)r
�_grouper�indicesr)r+r�s  r-r0z$ExpandingGroupby._get_window_indexer�s&��(� �M�M�1�1�+�
���r.N)r�r
)r�r�r�r�r r$rr0�r.r-r�r��s%����'�'�*;�*G�*G�G�K�r.r�N)(�
__future__r�textwrapr�typingrrrr�pandas.util._decoratorsr	r
�pandas.core.indexers.objectsrrr
�pandas.core.window.docrrrrrrrrr�pandas.core.window.rollingrr�pandas._typingrrr�pandasrr�pandas.core.genericrr r�r�r.r-�<module>r�sp��"�����
��

�
�
��
����,�{

�(�{

�|�(�)�r.

Youez - 2016 - github.com/yon3zu
LinuXploit