+
    Ŝi&                       ^ RI Ht ^ RIt^ RIHt ^ RIHtHt ^ RIt	^ RI
Ht ^ RIHu Hu Ht ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHt ^ R
IHt ^ RIHt ^ RIHt ^ RI H!t!H"t"H#t# ^ RI$H%t%H&t& ^ RI'H(t( ^ RI)H*t*H+t+ ^ RI,H-t-H.t. ^ RI/H0t0H1t1 ]'       d   ^ RI2H3t3H4t4H5t5 ^ RI6H7t7H8t8 ^ RI9H:t: R R lt;R R lt<]! R4       ! R R]04      4       t=]! R4       ! R R]1]=4      4       t> ! R R ]=4      t?R# )!    )annotationsN)partial)TYPE_CHECKINGcast)	Timedelta)
set_module)is_datetime64_dtypeis_numeric_dtype)DatetimeTZDtype)	ABCSeries)isna)common)dtype_to_unit)BaseIndexerExponentialMovingWindowIndexerGroupbyIndexer)get_jit_argumentsmaybe_use_numba)zsqrt)generate_numba_ewm_funcgenerate_numba_ewm_table_func)EWMMeanStategenerate_online_numba_ewma_func)
BaseWindowBaseWindowGroupby)TimedeltaConvertibleTypesTimeUnitnpt)	DataFrameSeries)NDFramec          
     ,    V ^8  d   QhRRRRRRRRRR/# )   comassfloat | Nonespanhalflifealphareturnfloat )formats   "_/Users/mibo/.openclaw/workspace/.venv-ak/lib/python3.14/site-packages/pandas/core/window/ewm.py__annotate__r.   ?   s:      
  	
     c                   \         P                  ! WW#4      pV^8  d   \        R4      hV e   V ^ 8  d   \        R4      hMVe$   V^8  d   \        R4      hV^,
          ^,          p MVe\   V^ 8:  d   \        R4      h^\        P                  ! \        P
                  ! R4      V,          4      ,
          p^V,          ^,
          p M9Ve+   V^ 8:  g   V^8  d   \        R4      h^V,
          V,          p M\        R4      h\        V 4      # )   z8comass, span, halflife, and alpha are mutually exclusivez comass must satisfy: comass >= 0zspan must satisfy: span >= 1z#halflife must satisfy: halflife > 0g      ?z"alpha must satisfy: 0 < alpha <= 1z1Must pass one of comass, span, halflife, or alpha)r   count_not_none
ValueErrornpexplogr*   )r$   r&   r'   r(   valid_countdecays   &&&&  r-   get_center_of_massr9   ?   s     ''hFKQSTT A:?@@ 		!8;<<(a		q=BCCBFF266#;122UQ		A:ABBe)u$LMM=r/   c               $    V ^8  d   QhRRRRRR/# )r#   timesznp.ndarray | NDFramer'   (float | TimedeltaConvertibleTypes | Noner)   znpt.NDArray[np.float64]r+   )r,   s   "r-   r.   r.   `   s&     ' ''6' 'r/   c                   \        V P                  4      p\        RV4      p\        V \        4      '       d   V P
                  p \        P                  ! V P                  \        P                  4      \        P                  R7      p\        \        V4      P                  V4      P                  4      p\        P                  ! V4      V,          # )a  
Return the diff of the times divided by the half-life. These values are used in
the calculation of the ewm mean.

Parameters
----------
times : np.ndarray, Series
    Times corresponding to the observations. Must be monotonically increasing
    and ``datetime64[ns]`` dtype.
halflife : float, str, timedelta, optional
    Half-life specifying the decay

Returns
-------
np.ndarray
    Diff of the times divided by the half-life
r   dtype)r   r?   r   
isinstancer   _valuesr4   asarrayviewint64float64r*   r   as_unit_valuediff)r;   r'   unit_times	_halflifes   &&   r-   _calculate_deltasrL   `   s    * %D
D!D%##ZZ

288,BJJ?Fi)11$7>>?I776?Y&&r/   zpandas.api.typingc                     a  ] tR t^~tRt. ROtRRR/R V 3R lllltR R ltR R	 ltRR
 R llt	RV 3R llt
]
tRR R lltRR R lltRR R lltRR R lltR R R lltR!R R lltRtV ;t# )"ExponentialMovingWindowa  
Provide exponentially weighted (EW) calculations.

Exactly one of ``com``, ``span``, ``halflife``, or ``alpha`` must be
provided if ``times`` is not provided. If ``times`` is provided and ``adjust=True``,
``halflife`` and one of ``com``, ``span`` or ``alpha`` may be provided.
If ``times`` is provided and ``adjust=False``, ``halflife`` must be the only
provided decay-specification parameter.

Parameters
----------
com : float, optional
    Specify decay in terms of center of mass

    :math:`\alpha = 1 / (1 + com)`, for :math:`com \geq 0`.

span : float, optional
    Specify decay in terms of span

    :math:`\alpha = 2 / (span + 1)`, for :math:`span \geq 1`.

halflife : float, str, timedelta, optional
    Specify decay in terms of half-life

    :math:`\alpha = 1 - \exp\left(-\ln(2) / halflife\right)`, for
    :math:`halflife > 0`.

    If ``times`` is specified, a timedelta convertible unit over which an
    observation decays to half its value. Only applicable to ``mean()``,
    and halflife value will not apply to the other functions.

alpha : float, optional
    Specify smoothing factor :math:`\alpha` directly

    :math:`0 < \alpha \leq 1`.

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

adjust : bool, default True
    Divide by decaying adjustment factor in beginning periods to account
    for imbalance in relative weightings (viewing EWMA as a moving average).

    - When ``adjust=True`` (default), the EW function is calculated using weights
      :math:`w_i = (1 - \alpha)^i`. For example, the EW moving average of the series
      [:math:`x_0, x_1, ..., x_t`] would be:

    .. math::
        y_t = \frac{x_t + (1 - \alpha)x_{t-1} + (1 - \alpha)^2 x_{t-2} + ... + (1 -
        \alpha)^t x_0}{1 + (1 - \alpha) + (1 - \alpha)^2 + ... + (1 - \alpha)^t}

    - When ``adjust=False``, the exponentially weighted function is calculated
      recursively:

    .. math::
        \begin{split}
            y_0 &= x_0\\
            y_t &= (1 - \alpha) y_{t-1} + \alpha x_t,
        \end{split}
ignore_na : bool, default False
    Ignore missing values when calculating weights.

    - When ``ignore_na=False`` (default), weights are based on absolute positions.
      For example, the weights of :math:`x_0` and :math:`x_2` used in calculating
      the final weighted average of [:math:`x_0`, None, :math:`x_2`] are
      :math:`(1-\alpha)^2` and :math:`1` if ``adjust=True``, and
      :math:`(1-\alpha)^2` and :math:`\alpha` if ``adjust=False``.

    - When ``ignore_na=True``, weights are based
      on relative positions. For example, the weights of :math:`x_0` and :math:`x_2`
      used in calculating the final weighted average of
      [:math:`x_0`, None, :math:`x_2`] are :math:`1-\alpha` and :math:`1` if
      ``adjust=True``, and :math:`1-\alpha` and :math:`\alpha` if ``adjust=False``.

times : np.ndarray, Series, default None

    Only applicable to ``mean()``.

    Times corresponding to the observations. Must be monotonically increasing and
    ``datetime64[ns]`` dtype.

    If 1-D array like, a sequence with the same shape as the observations.

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.

    Only applicable to ``mean()``

Returns
-------
pandas.api.typing.ExponentialMovingWindow
    An instance of ExponentialMovingWindow for further exponentially weighted (EW)
    calculations, e.g. using the ``mean`` method.

See Also
--------
rolling : Provides rolling window calculations.
expanding : Provides expanding transformations.

Notes
-----
See :ref:`Windowing Operations <window.exponentially_weighted>`
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

>>> df.ewm(com=0.5).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213
>>> df.ewm(alpha=2 / 3).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213

**adjust**

>>> df.ewm(com=0.5, adjust=True).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213
>>> df.ewm(com=0.5, adjust=False).mean()
          B
0  0.000000
1  0.666667
2  1.555556
3  1.555556
4  3.650794

**ignore_na**

>>> df.ewm(com=0.5, ignore_na=True).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.225000
>>> df.ewm(com=0.5, ignore_na=False).mean()
          B
0  0.000000
1  0.750000
2  1.615385
3  1.615385
4  3.670213

**times**

Exponentially weighted mean with weights calculated with a timedelta ``halflife``
relative to ``times``.

>>> times = ['2020-01-01', '2020-01-03', '2020-01-10', '2020-01-15', '2020-01-17']
>>> df.ewm(halflife='4 days', times=pd.DatetimeIndex(times)).mean()
          B
0  0.000000
1  0.585786
2  1.523889
3  1.523889
4  3.233686
N	selectionc               D    V ^8  d   QhRRRRRRRRRRR	R
RRRRRRRRRR/# )r#   objr!   comr%   r&   r'   r<   r(   min_periods
int | Noneadjustbool	ignore_nar;   np.ndarray | NDFrame | Nonemethodstrr)   Noner+   )r,   s   "r-   r.   $ExponentialMovingWindow.__annotate__D  s     J JJ J 	J
 ;J J  J J J +J J 
Jr/   c          
     	  < \         ST `  TVf   ^M\        \        V4      ^4      R RR V
VR7       W n        W0n        W@n        WPn        Wpn        Wn	        Wn
        V P                  Ee   \        V P                  RR 4      p\        V4      '       g"   \        V\        4      '       g   \        R4      h\!        V P                  4      \!        V4      8w  d   \        R4      h\        V P                  \"        \$        P&                  \(        P*                  34      '       g   \        R4      h\-        V P                  4      P/                  4       '       d   \        R4      h\1        V P                  V P                  4      V n        \4        P6                  ! V P                  V P
                  V P                  4      ^ 8  dQ   V P                  '       g   \9        R4      h\;        V P                  V P
                  R V P                  4      V n        R # R	V n        R # V P                  eK   \        V P                  \"        \$        P&                  \(        P*                  34      '       d   \        R
4      h\(        P>                  ! \        V P@                  PB                  ^ ,          ^,
          ^ 4      \(        PD                  R7      V n        \;        V P                  V P
                  V P                  V P                  4      V n        R # )NF)rQ   rS   oncenterclosedrY   rO   r?   ztimes must be datetime64 dtype.z,times must be the same length as the object.z/halflife must be a timedelta convertible objectz$Cannot convert NaT values to integerzRNone of com, span, or alpha can be specified if times is provided and adjust=Falseg      ?zKhalflife can only be a timedelta convertible argument if times is not None.r>   )#super__init__maxintrR   r&   r'   r(   rU   rW   r;   getattrr	   r@   r   r3   lenrZ   datetime	timedeltar4   timedelta64r   anyrL   _deltasr   r2   NotImplementedErrorr9   _comonesrQ   shaperE   )selfrQ   rR   r&   r'   r(   rS   rU   rW   r;   rY   rO   times_dtype	__class__s   &&&&&&&&&&&$ r-   rb    ExponentialMovingWindow.__init__D  s2    	(0c#k:JA6N 	 	
 	 
"
::!!$**gt<K#K00k?;; !BCC4::#c(* !OPPdmmc83E3Er~~-VWW !RSSDJJ##%% !GHH,TZZGDL $$TXXtyy$**EI{{{-=  /txxD$**U		}}(ZX%7%7H. . !) 
 773txx~~a'81'<a#@

SDL* 		

DIr/   c               (    V ^8  d   QhRRRRRRRR/# )r#   startz
np.ndarrayendnum_valsrd   r)   r[   r+   )r,   s   "r-   r.   r\     s,      &0<?	r/   c                	    R # Nr+   )rp   ru   rv   rw   s   &&&&r-   _check_window_bounds,ExponentialMovingWindow._check_window_bounds  s    
 	r/   c                   V ^8  d   QhRR/# )r#   r)   r   r+   )r,   s   "r-   r.   r\     s     0 0[ 0r/   c                    \        4       # )zK
Return an indexer class that will compute the window start and end bounds
)r   rp   s   &r-   _get_window_indexer+ExponentialMovingWindow._get_window_indexer  s     .//r/   c                    V ^8  d   QhRRRR/# )r#   enginerZ   r)   OnlineExponentialMovingWindowr+   )r,   s   "r-   r.   r\     s     '
 '
'
	&'
r/   c                    \        V P                  V P                  V P                  V P                  V P
                  V P                  V P                  V P                  V P                  VVV P                  R7      # )a  
Return an ``OnlineExponentialMovingWindow`` object to calculate
exponentially moving window aggregations in an online method.

Parameters
----------
engine: str, default ``'numba'``
    Execution engine to calculate online aggregations.
    Applies to all supported aggregation methods.

engine_kwargs : dict, default None
    Applies to all supported aggregation methods.

    * For ``'numba'`` engine, the engine can accept ``nopython``, ``nogil``
      and ``parallel`` dictionary keys. The values must either be ``True`` or
      ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
      ``{{'nopython': True, 'nogil': False, 'parallel': False}}`` and will be
      applied to the function

Returns
-------
OnlineExponentialMovingWindow
)rQ   rR   r&   r'   r(   rS   rU   rW   r;   r   engine_kwargsrO   )r   rQ   rR   r&   r'   r(   rS   rU   rW   r;   
_selection)rp   r   r   s   &&&r-   onlineExponentialMovingWindow.online  s_    4 -]]**((;;nn**'oo
 	
r/   c                ,   < \         SV `  ! V.VO5/ VB # )a  
Aggregate using one or more operations over the specified axis.

Parameters
----------
func : function, str, list or dict
    Function to use for aggregating the data. If a function, must either
    work when passed a Series/Dataframe or when passed to
    Series/Dataframe.apply.

    Accepted combinations are:

    - function
    - string function name
    - list of functions and/or function names, e.g. ``[np.sum, 'mean']``
    - dict of axis labels -> functions, function names or list of such.
*args
    Positional arguments to pass to `func`.
**kwargs
    Keyword arguments to pass to `func`.

Returns
-------
scalar, Series or DataFrame

    The return can be:

    * scalar : when Series.agg is called with single function
    * Series : when DataFrame.agg is called with a single function
    * DataFrame : when DataFrame.agg is called with several functions

See Also
--------
pandas.DataFrame.rolling.aggregate

Notes
-----
The aggregation operations are always performed over an axis, either the
index (default) or the column axis. This behavior is different from
`numpy` aggregation functions (`mean`, `median`, `prod`, `sum`, `std`,
`var`), where the default is to compute the aggregation of the flattened
array, e.g., ``numpy.mean(arr_2d)`` as opposed to
``numpy.mean(arr_2d, axis=0)``.

`agg` is an alias for `aggregate`. Use the alias.

Functions that mutate the passed object can produce unexpected
behavior or errors and are not supported. See :ref:`gotchas.udf-mutation`
for more details.

A passed user-defined-function will be passed a Series for evaluation.

If ``func`` defines an index relabeling, ``axis`` must be ``0`` or ``index``.

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
)ra   	aggregate)rp   funcargskwargsrr   s   &&*,r-   r   !ExponentialMovingWindow.aggregate  s     L w 7777r/   c                   V ^8  d   QhRR/# r#   numeric_onlyrV   r+   )r,   s   "r-   r.   r\     s     SJ SJSJr/   c                >   \        V4      '       d   V P                  R8X  d   \        pM\        pV! R/ \	        V4      BRV P
                  RV P                  RV P                  R\        V P                  4      RR/B pV P                  VRR	7      # VR9   d}   Ve   \        R4      hV P                  f   R
MV P                  p\        \        P                  V P
                  V P                  V P                  VRR7      pV P                  VRVR7      # \        R4      h)a  
Calculate the ewm (exponential weighted moment) mean.

Parameters
----------
numeric_only : bool, default False
    Include only float, int, boolean columns.

engine : str, default None
    * ``'cython'`` : Runs the operation through C-extensions from cython.
    * ``'numba'`` : Runs the operation through JIT compiled code from numba.
    * ``None`` : Defaults to ``'cython'`` or globally setting
      ``compute.use_numba``

engine_kwargs : dict, default None
    * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
    * For ``'numba'`` engine, the engine can accept ``nopython``, ``nogil``
      and ``parallel`` dictionary keys. The values must either be ``True`` or
      ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
      ``{{'nopython': True, 'nogil': False, 'parallel': False}}``

Returns
-------
Series or DataFrame
    Return type is the same as the original object with ``np.float64`` dtype.

See Also
--------
Series.ewm : Calling ewm with Series data.
DataFrame.ewm : Calling ewm with DataFrames.
Series.mean : Aggregating mean for Series.
DataFrame.mean : Aggregating mean for DataFrame.

Notes
-----
See :ref:`window.numba_engine` and :ref:`enhancingperf.numba` for
extended documentation and performance considerations for the Numba engine.

Examples
--------
>>> ser = pd.Series([1, 2, 3, 4])
>>> ser.ewm(alpha=0.2).mean()
0    1.000000
1    1.555556
2    2.147541
3    2.775068
dtype: float64
singlerR   rU   rW   deltas	normalizeTmeannameN+cython engine does not accept engine_kwargsrR   rU   rW   r   r   r   r   )engine must be either 'numba' or 'cython'r+   cythonN)r   rY   r   r   r   rm   rU   rW   tuplerk   _applyr3   r;   r   window_aggregationsewmrp   r   r   r   r   ewm_funcr   window_funcs   &&&&    r-   r   ExponentialMovingWindow.mean  s   l 6""{{h&.4 #M2II {{ ..	
 T\\* H ;;xf;55''( !NOO!ZZ/TT\\F!#''II{{..K ;;{l;SSHIIr/   c                   V ^8  d   QhRR/# r   r+   )r,   s   "r-   r.   r\   e  s     UJ UJUJr/   c                   V P                   '       g   \        R4      hV P                  e   \        R4      h\        V4      '       d   V P                  R8X  d   \
        pM\        pV! R/ \        V4      BRV P                  RV P                   RV P                  R\        V P                  4      R	R
/B pV P                  VRR7      # VR9   d}   Ve   \        R4      hV P                  f   RMV P                  p\        \        P                   V P                  V P                   V P                  VR
R7      pV P                  VRVR7      # \        R4      h)a  
Calculate the ewm (exponential weighted moment) sum.

Parameters
----------
numeric_only : bool, default False
    Include only float, int, boolean columns.
engine : str, default None
    * ``'cython'`` : Runs the operation through C-extensions from cython.
    * ``'numba'`` : Runs the operation through JIT compiled code from numba.
    * ``None`` : Defaults to ``'cython'`` or globally setting
      ``compute.use_numba``
engine_kwargs : dict, default None
    * For ``'cython'`` engine, there are no accepted ``engine_kwargs``
    * For ``'numba'`` engine, the engine can accept ``nopython``, ``nogil``
      and ``parallel`` dictionary keys. The values must either be ``True`` or
      ``False``. The default ``engine_kwargs`` for the ``'numba'`` engine is
      ``{'nopython': True, 'nogil': False, 'parallel': False}``

Returns
-------
Series or DataFrame
    Return type is the same as the original object with ``np.float64`` dtype.

See Also
--------
Series.ewm : Calling ewm with Series data.
DataFrame.ewm : Calling ewm with DataFrames.
Series.sum : Aggregating sum for Series.
DataFrame.sum : Aggregating sum for DataFrame.

Notes
-----
See :ref:`window.numba_engine` and :ref:`enhancingperf.numba` for extended
documentation and performance considerations for the Numba engine.

Examples
--------
>>> ser = pd.Series([1, 2, 3, 4])
>>> ser.ewm(alpha=0.2).sum()
0    1.000
1    2.800
2    5.240
3    8.192
dtype: float64
z(sum is not implemented with adjust=FalseNz!sum is not implemented with timesr   rR   rU   rW   r   r   Fsumr   r   r   r   r   r+   r   )rU   rl   r;   r   rY   r   r   r   rm   rW   r   rk   r   r3   r   r   r   r   s   &&&&    r-   r   ExponentialMovingWindow.sume  sB   h {{{%&PQQ::!%&IJJ6""{{h&.4 #M2II {{ ..	
 T\\*  H ;;xe;44''( !NOO!ZZ/TT\\F!#''II{{..K ;;{\;RRHIIr/   c                    V ^8  d   QhRRRR/# r#   biasrV   r   r+   )r,   s   "r-   r.   r\     s     ,E ,E ,ED ,Er/   c                <   V'       db   V P                   P                  ^8X  dG   \        V P                   P                  4      '       g"   \	        \        V 4      P                   R24      hV P                  e   \	        R4      h\        V P                  WR7      4      # )a  
Calculate the ewm (exponential weighted moment) standard deviation.

Parameters
----------
bias : bool, default False
    Use a standard estimation bias correction.
numeric_only : bool, default False
    Include only float, int, boolean columns.

Returns
-------
Series or DataFrame
    Return type is the same as the original object with ``np.float64`` dtype.

See Also
--------
Series.ewm : Calling ewm with Series data.
DataFrame.ewm : Calling ewm with DataFrames.
Series.std : Aggregating std for Series.
DataFrame.std : Aggregating std for DataFrame.

Examples
--------
>>> ser = pd.Series([1, 2, 3, 4])
>>> ser.ewm(alpha=0.2).std()
0         NaN
1    0.707107
2    0.995893
3    1.277320
dtype: float64
z$.std does not implement numeric_onlyz!std is not implemented with times)r   r   )
_selected_objndimr
   r?   rl   type__name__r;   r   varrp   r   r   s   &&&r-   stdExponentialMovingWindow.std  s    D ""''1,$T%7%7%=%=>> &:&&''KL  ::!%&IJJTXX4XCDDr/   c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   r\     s     /L /L /LD /Lr/   c                   a V P                   e   \        R4      h\        P                  p\	        VV P
                  V P                  V P                  VR7      oV3R lpV P                  VRVR7      # )a  
Calculate the ewm (exponential weighted moment) variance.

Parameters
----------
bias : bool, default False
    Use a standard estimation bias correction.
numeric_only : bool, default False
    Include only float, int, boolean columns.

Returns
-------
Series or DataFrame
    Return type is the same as the original object with ``np.float64`` dtype.

See Also
--------
Series.ewm : Calling ewm with Series data.
DataFrame.ewm : Calling ewm with DataFrames.
Series.var : Aggregating var for Series.
DataFrame.var : Aggregating var for DataFrame.

Examples
--------
>>> ser = pd.Series([1, 2, 3, 4])
>>> ser.ewm(alpha=0.2).var()
0         NaN
1    0.500000
2    0.991803
3    1.631547
dtype: float64
z!var is not implemented with times)rR   rU   rW   r   c                   < S! WW#V 4      # ry   r+   )valuesbeginrv   rS   wfuncs   &&&&r-   var_func-ExponentialMovingWindow.var.<locals>.var_func  s    &AAr/   r   r   )	r;   rl   r   ewmcovr   rm   rU   rW   r   )rp   r   r   r   r   r   s   &&&  @r-   r   ExponentialMovingWindow.var  si    B ::!%&IJJ)00		;;nn
	B {{8%l{KKr/   c               (    V ^8  d   QhRRRRRRRR/# r#   otherDataFrame | Series | Nonepairwisebool | Noner   rV   r   r+   )r,   s   "r-   r.   r\     s8     Z
 Z
(Z
 Z
 	Z

 Z
r/   c                   a aa S P                   e   \        R4      h^ RIHo S P	                  RV4       VVV 3R lpS P                  S P                  WWT4      # )a  
Calculate the ewm (exponential weighted moment) sample covariance.

Parameters
----------
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 MultiIndex DataFrame in the case of DataFrame
    inputs. In the case of missing elements, only complete pairwise
    observations will be used.
bias : bool, default False
    Use a standard estimation bias correction.
numeric_only : bool, default False
    Include only float, int, boolean columns.

Returns
-------
Series or DataFrame
    Return type is the same as the original object with ``np.float64`` dtype.

See Also
--------
Series.ewm : Calling ewm with Series data.
DataFrame.ewm : Calling ewm with DataFrames.
Series.cov : Aggregating cov for Series.
DataFrame.cov : Aggregating cov for DataFrame.

Examples
--------
>>> ser1 = pd.Series([1, 2, 3, 4])
>>> ser2 = pd.Series([10, 11, 13, 16])
>>> ser1.ewm(alpha=0.2).cov(ser2)
0         NaN
1    0.500000
2    1.524590
3    3.408836
dtype: float64
z!cov is not implemented with timesr    covc                  < SP                  V 4      pSP                  V4      pSP                  4       pSP                  e   SP                  MVP                  pVP	                  \        V4      VSP                  SP                  SP                  R7      w  rg\        P                  ! VVVSP                  VSP                  SP                  SP                  S
4	      pS	! WP                  V P                  RR7      # )N
num_valuesrS   r_   r`   stepFindexr   copy)_prep_valuesr   rS   window_sizeget_window_boundsrf   r_   r`   r   r   r   rm   rU   rW   r   r   )xyx_arrayy_arraywindow_indexerrS   ru   rv   resultr    r   rp   s   &&       r-   cov_func-ExponentialMovingWindow.cov.<locals>.cov_funcT  s    ''*G''*G!557N ##/   #// 
 (99w<'{{{{YY : JE )//   		F &aff5IIr/   r;   rl   pandasr    _validate_numeric_only_apply_pairwiser   )rp   r   r   r   r   r   r    s   f&&f& @r-   r   ExponentialMovingWindow.cov  sW    d ::!%&IJJ!##E<8	J> ##
 	
r/   c               $    V ^8  d   QhRRRRRR/# r#   r   r   r   r   r   rV   r+   )r,   s   "r-   r.   r\   w  s-     ]
 ]
(]
 ]
 	]
r/   c                   a a S P                   e   \        R4      h^ RIHo S P	                  RV4       VV 3R lpS P                  S P                  WWC4      # )a  
Calculate the ewm (exponential weighted moment) sample correlation.

Parameters
----------
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 MultiIndex DataFrame in the case of DataFrame
    inputs. In the case of missing elements, only complete pairwise
    observations will be used.
numeric_only : bool, default False
    Include only float, int, boolean columns.

Returns
-------
Series or DataFrame
    Return type is the same as the original object with ``np.float64`` dtype.

See Also
--------
Series.ewm : Calling ewm with Series data.
DataFrame.ewm : Calling ewm with DataFrames.
Series.corr : Aggregating corr for Series.
DataFrame.corr : Aggregating corr for DataFrame.

Examples
--------
>>> ser1 = pd.Series([1, 2, 3, 4])
>>> ser2 = pd.Series([10, 11, 13, 16])
>>> ser1.ewm(alpha=0.2).corr(ser2)
0         NaN
1    1.000000
2    0.982821
3    0.977802
dtype: float64
z"corr is not implemented with timesr   corrc                b  <a
aa SP                  V 4      pSP                  V4      pSP                  4       pSP                  e   SP                  MVP                  oVP	                  \        V4      SSP                  SP                  SP                  R7      w  oo
V
VVV3R lp\        P                  ! RR7      ;_uu_ 4        V! W#4      pV! W"4      pV! W34      pV\        Wx,          4      ,          p	R R R 4       S! X	V P                  V P                  RR7      #   + '       g   i     L0; i)Nr   c                |   < \         P                  ! V SSSVSP                  SP                  SP                  R 4	      # )T)r   r   rm   rU   rW   )XYrv   rS   rp   ru   s   &&r-   _cov<ExponentialMovingWindow.corr.<locals>.cov_func.<locals>._cov  s=    *11IIKKNN
 
r/   ignore)allFr   )r   r   rS   r   r   rf   r_   r`   r   r4   errstater   r   r   )r   r   r   r   r   r   r   x_vary_varr   rv   rS   ru   r    rp   s   &&        @@@r-   r   .ExponentialMovingWindow.corr.<locals>.cov_func  s   ''*G''*G!557N ##/   #// 
 (99w<'{{{{YY : JE3  **7,W.W.uU]33	 +
 &aff5II +*s   1DD.	r   )rp   r   r   r   r   r    s   f&&& @r-   r   ExponentialMovingWindow.corrw  sX    ^ ::!%&JKK!##FL9#	JJ ##
 	
r/   )	rm   rk   rU   r(   rR   r'   rW   r&   r;   )	rR   r&   r'   r(   rS   rU   rW   r;   rY   )	NNNNr   TFNr   )numbaNry   )FNNFFNNFFNNF)r   
__module____qualname____firstlineno____doc___attributesrb   rz   r   r   r   aggr   r   r   r   r   r   __static_attributes____classcell__rr   s   @r-   rN   rN   ~   sx    vp
KJ J JX0'
RF8P CSJjUJn,E\/LbZ
x]
 ]
r/   rN   c                     a  ] tR tRtRt]P                  ]P                  ,           tRR/R V 3R llltR R lt	R	t
V ;t# )
ExponentialMovingWindowGroupbyi  z>
Provide an exponential moving window groupby implementation.
_grouperNc                   V ^8  d   QhRR/# r#   r)   r[   r+   )r,   s   "r-   r.   +ExponentialMovingWindowGroupby.__annotate__  s     	 	t 	r/   c               	f  < \         SV `  ! V.VO5R V/VB  VP                  '       g   V P                  ex   \        P
                  ! \        V P                  P                  P                  4       4      4      p\        V P                  P                  V4      V P                  4      V n        R# R# R# )r  N)ra   rb   emptyr;   r4   concatenatelistr  indicesr   rL   taker'   rk   )rp   rQ   r  r   r   groupby_orderrr   s   &&$*, r-   rb   'ExponentialMovingWindowGroupby.__init__  s    AtAhA&AyyyTZZ3NN40E0E0L0L0N+OPM,

.DL 4yr/   c                   V ^8  d   QhRR/# )r#   r)   r   r+   )r,   s   "r-   r.   r    s      ^ r/   c                P    \        V P                  P                  \        R7      pV# )zk
Return an indexer class that will compute the window start and end bounds

Returns
-------
GroupbyIndexer
)groupby_indicesr   )r   r  r	  r   )rp   r   s   & r-   r   2ExponentialMovingWindowGroupby._get_window_indexer  s&     ( MM119
 r/   )rk   )r   r   r   r   r   rN   r   r   rb   r   r   r   r   s   @r-   r   r     s<     *558I8U8UUK	D 	 	 r/   r   c                     a  ] tR tRtRRR/R V 3R lllltR R ltRR ltRR	 R
 lltRR R lltRR R llt	RR R llt
RRRR/R ltRtV ;t# )r   i  NrO   c               H    V ^8  d   QhRRRRRRRRRRR	R
RRRRRRRRRRRR/# )r#   rQ   r!   rR   r%   r&   r'   r<   r(   rS   rT   rU   rV   rW   r;   rX   r   rZ   r   zdict[str, bool] | Noner)   r[   r+   )r,   s   "r-   r.   *OnlineExponentialMovingWindow.__annotate__  s     %E %E%E %E 	%E
 ;%E %E  %E %E %E +%E %E .%E 
%Er/   c               	  < V	e   \        R4      h\        SV `	  VVVVVVVVV	VR7
       \        V P                  V P
                  V P                  VP                  4      V n        \        V
4      '       d   Wn
        Wn        R # \        R4      h)Nz0times is not implemented with online operations.)
rQ   rR   r&   r'   r(   rS   rU   rW   r;   rO   z$'numba' is the only supported engine)rl   ra   rb   r   rm   rU   rW   ro   _meanr   r   r   r3   )rp   rQ   rR   r&   r'   r(   rS   rU   rW   r;   r   r   rO   rr   s   &&&&&&&&&&&&$r-   rb   &OnlineExponentialMovingWindow.__init__  s      %B  	# 	 	
 "$))T[[$..#))T
6"" K!.CDDr/   c                   V ^8  d   QhRR/# r  r+   )r,   s   "r-   r.   r  !  s      t r/   c                :    V P                   P                  4        R# )z-
Reset the state captured by `update` calls.
N)r  resetr~   s   &r-   r  #OnlineExponentialMovingWindow.reset!  s     	

r/   c                	    \        R 4      h)zaggregate is not implemented.rl   )rp   r   r   r   s   &&*,r-   r   'OnlineExponentialMovingWindow.aggregate'  s    !"ABBr/   c                   V ^8  d   QhRR/# )r#   r   rV   r+   )r,   s   "r-   r.   r  *  s     = = =r/   c                	    \        R 4      h)zstd is not implemented.r  )rp   r   r   r   s   &&*,r-   r   !OnlineExponentialMovingWindow.std*      !";<<r/   c               $    V ^8  d   QhRRRRRR/# r   r+   )r,   s   "r-   r.   r  -  s(     > >(> > 	>r/   c                	    \        R 4      h)zcorr is not implemented.r  )rp   r   r   r   s   &&&&r-   r   "OnlineExponentialMovingWindow.corr-  s     ""<==r/   c               (    V ^8  d   QhRRRRRRRR/# r   r+   )r,   s   "r-   r.   r  5  s2     = =(= = 	=
 =r/   c                	    \        R 4      h)zcov is not implemented.r  )rp   r   r   r   r   s   &&&&&r-   r   !OnlineExponentialMovingWindow.cov5  s     "";<<r/   c                    V ^8  d   QhRRRR/# r   r+   )r,   s   "r-   r.   r  >  s     = = =D =r/   c                	    \        R 4      h)zvar is not implemented.r  r   s   &&&r-   r   !OnlineExponentialMovingWindow.var>  r!  r/   updateupdate_timesc                  / pV P                   P                  ^8H  pVe   \        R4      h\        P                  ! \        V P                   P                  R	,          ^,
          ^ 4      \        P                  R7      pVe   V P                  P                  f   \        R4      h^pVP                  VR&   V'       d>   V P                  P                  \        P                  R3,          p	VP                  VR&   M%V P                  P                  p	VP                  VR&   \        P                  ! WP!                  4       34      p
M^ pV P                   P                  VR&   V'       d   V P                   P                  VR&   MV P                   P                  VR&   V P                   P#                  \        P                  4      P!                  4       p
\%        R
/ \'        V P(                  4      B pV P                  P+                  V'       d   T
MV
R\        P                  3,          VV P,                  V4      pV'       g   VP/                  4       pWR pV P                   P0                  ! V3/ VB pV# )a3  
Calculate an online exponentially weighted mean.

Parameters
----------
update: DataFrame or Series, default None
    New values to continue calculating the
    exponentially weighted mean from the last values and weights.
    Values should be float64 dtype.

    ``update`` needs to be ``None`` the first time the
    exponentially weighted mean is calculated.

update_times: Series or 1-D np.ndarray, default None
    New times to continue calculating the
    exponentially weighted mean from the last values and weights.
    If ``None``, values are assumed to be evenly spaced
    in time.
    This feature is currently unsupported.

Returns
-------
DataFrame or Series

Examples
--------
>>> df = pd.DataFrame({"a": range(5), "b": range(5, 10)})
>>> online_ewm = df.head(2).ewm(0.5).online()
>>> online_ewm.mean()
      a     b
0  0.00  5.00
1  0.75  5.75
>>> online_ewm.mean(update=df.tail(3))
          a         b
2  1.615385  6.615385
3  2.550000  7.550000
4  3.520661  8.520661
>>> online_ewm.reset()
>>> online_ewm.mean()
      a     b
0  0.00  5.00
1  0.75  5.75
Nz update_times is not implemented.r>   z;Must call mean with update=None first before passing updater   :NNNcolumnsr   r+   )r   r   rl   r4   rn   rc   ro   rE   r  last_ewmr3   r   newaxisr.  r   r  to_numpyastyper   r   r   run_ewmrS   squeeze_constructor)rp   r+  r,  r   r   result_kwargsis_frameupdate_deltasresult_from
last_valuenp_array	ewma_funcr   s   &$$*,        r-   r   "OnlineExponentialMovingWindow.meanA  s   X %%**a/#%&HII""((,q0!4BJJ
 zz""* Q  K%+\\M'"!ZZ00Q?
+1>>i(!ZZ00
(.f%~~z??3D&EFHK%)%7%7%=%=M'"+/+=+=+E+Ei((,(:(:(?(?f%))00<EEGH3 
 2 23
	 ## Hhq"**}&=	
 ^^%F%##00I=Ir/   )r  r   r   )
NNNNr   TFNr   Nry   )Fr   r   r   )r   r   r   r   rb   r  r   r   r   r   r   r   r   r   r   s   @r-   r   r     sV    %E %E %ENC=>==V VD V Vr/   r   )@
__future__r   rg   	functoolsr   typingr   r   numpyr4   pandas._libs.tslibsr    pandas._libs.window.aggregations_libswindowaggregationsr   pandas.util._decoratorsr   pandas.core.dtypes.commonr	   r
   pandas.core.dtypes.dtypesr   pandas.core.dtypes.genericr   pandas.core.dtypes.missingr   pandas.corer   pandas.core.arrays.datetimeliker   pandas.core.indexers.objectsr   r   r   pandas.core.util.numba_r   r   pandas.core.window.commonr   pandas.core.window.numba_r   r   pandas.core.window.onliner   r   pandas.core.window.rollingr   r   pandas._typingr   r   r   r   r   r    pandas.core.genericr!   r9   rL   rN   r   r   r+   r/   r-   <module>rW     s    "  
  ) > > . 6 0 +  9 
 ,
   ,B'<  U
j U
 !U
p  %68O  !B^$; ^r/   