hyb
2025-12-30 5e753a15ff53faab2261a53367e44d38caf87041
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
Ë
nñúhv‰ãóð—ddlmZddlZddlmZddlmZddlmZddl    Z
ddl m Z ddl mcmcmZddlmZddlmZmZdd    lmZdd
lmZdd lmZdd lmZdd lm Z ddl!m"Z"m#Z#m$Z$ddl%m&Z&m'Z'ddl(m)Z)ddl*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4m5Z5ddl6m7Z7m8Z8ddl9m:Z:m;Z;erddl<m=Z=m>Z>m?Z?ddl@mAZAmBZBddlCmDZD                                        d d„ZE                        d!d„ZFGd„de:«ZGGd„de;eG«ZHGd„deG«ZIy)"é)Ú annotationsN)Úpartial)Údedent)Ú TYPE_CHECKING)Ú    Timedelta)Údoc)Úis_datetime64_dtypeÚis_numeric_dtype)ÚDatetimeTZDtype)Ú    ABCSeries)Úisna)Úcommon)Ú dtype_to_unit)Ú BaseIndexerÚExponentialMovingWindowIndexerÚGroupbyIndexer)Úget_jit_argumentsÚmaybe_use_numba)Úzsqrt)Ú _shared_docsÚcreate_section_headerÚkwargs_numeric_onlyÚ numba_notesÚtemplate_headerÚtemplate_returnsÚtemplate_see_alsoÚwindow_agg_numba_parameters)Úgenerate_numba_ewm_funcÚgenerate_numba_ewm_table_func)Ú EWMMeanStateÚgenerate_online_numba_ewma_func)Ú
BaseWindowÚBaseWindowGroupby)ÚAxisÚTimedeltaConvertibleTypesÚnpt)Ú    DataFrameÚSeries)ÚNDFramecóæ—tj||||«}|dkDr td«‚||dkr¸td«‚|#|dkr td«‚|dz
dz }t |«S|Q|dkr td«‚dtjtj
d«|z «z
}d|z dz
}t |«S|(|dks|dkDr td    «‚d|z
|z }t |«Std
«‚t |«S) Néz8comass, span, halflife, and alpha are mutually exclusiverz comass must satisfy: comass >= 0zspan must satisfy: span >= 1éz#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ÚlogÚfloat)ÚcomassÚspanÚhalflifeÚalphaÚ valid_countÚdecays      úIH:\Change_password\venv_build\Lib\site-packages\pandas/core/window/ewm.pyÚget_center_of_massr:Gs!€ô ×'Ñ'¨°°hÀÓF€KؐQ‚ÜÐSÓTÐTðÐØ AŠ:ÜÐ?Ó@Ð @Ø     Р   Ø !Š8ÜÐ;Ó<Ð <ؘ‘(˜a‘ˆô ‹=Ðð
Р   Ø qŠ=ÜÐBÓCÐ CØ”B—F‘Fœ2Ÿ6™6 #›;¨Ñ1Ó2Ñ2ˆØU‘˜Q‘ˆô ‹=Ðð
Р   Ø AŠ:˜ šÜÐAÓBÐ Bؐe‘)˜uÑ$ˆô ‹=ÐôÐLÓMÐMä ‹=Ðócór—t|j«}t|t«r |j}t j |jt
j«t
j¬«}tt|«j|«j«}t j|«|z S)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
    ©Údtype)rr>Ú
isinstancer Ú_valuesr/ÚasarrayÚviewÚint64Úfloat64r2rÚas_unitÚ_valueÚdiff)Útimesr5ÚunitÚ_timesÚ    _halflifes     r9Ú_calculate_deltasrLhsy€ô* ˜Ÿ™Ó %€Dܐ%œÔ#Ø— ‘ ˆÜ Z‰Z˜Ÿ
™
¤2§8¡8Ó,´B·J±JÔ ?€FÜ”i Ó)×1Ñ1°$Ó7×>Ñ>Ó?€IÜ 7‰76‹?˜YÑ &Ð&r;cóR‡—eZdZdZgd¢Z                                        d2ddœ                                                                                            d3ˆfd„Z                                d4d„Zd5d„Z    d6            d7d„Ze    e
d    e d
«e d «d d ¬«ˆfd„«Z e Z e    eed«ee«ed«eed«eed«eed«e d«ddd¬«            d8    d9d„«Ze    eed«ee«ed«eed«eed«eed«e d«ddd¬«            d8    d9d„«Ze    eed«e d«eed«eed«eed«e d «dd!d"¬« d:d;d#„«Ze    eed«e d«eed«eed«eed«e d$«dd%d&¬« d:d;d'„«Ze    eed«e d(«eed«eed«eed«e d)«dd*d+¬«                 d<                            d=d,„«Ze    eed«e d-«eed«eed«eed«e d.«dd/d0¬«             d>                    d?d1„«ZˆxZS)@Ú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,
    ``halflife`` and one of ``com``, ``span`` or ``alpha`` may be provided.
 
    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``.
 
    axis : {0, 1}, default 0
        If ``0`` or ``'index'``, calculate across the rows.
 
        If ``1`` or ``'columns'``, calculate across the columns.
 
        For `Series` this parameter is unused and defaults to 0.
 
    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'
        .. versionadded:: 1.4.0
 
        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
 
    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
    )
Úcomr4r5r6Ú min_periodsÚadjustÚ    ignore_naÚaxisrHÚmethodN©Ú    selectionc 
ó¶•—t‰|||€dntt|«d«ddd| |    | ¬«||_||_||_||_||_||_    |
|_
|j‰|js td«‚t|jdd«} t| «st| t«s t!d«‚t#|j«t#|«k7r t!d«‚t|j t$t&j(t*j,f«s t!d«‚t/|j«j1«r t!d    «‚t3|j|j «|_t7j8|j|j
|j«d
kDr2t;|j|j
d|j«|_yd |_y|j Dt|j t$t&j(t*j,f«r t!d «‚t+j>t|j@jB|jDdz
d
«t*jF¬ «|_t;|j|j
|j |j«|_y)Nr+F)ÚobjrPÚonÚcenterÚclosedrTrSrVz)times is not supported with adjust=False.r>ztimes 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 integerrgð?zKhalflife can only be a timedelta convertible argument if times is not None.r=)$ÚsuperÚ__init__ÚmaxÚintrOr4r5r6rQrRrHÚNotImplementedErrorÚgetattrr    r?r r.ÚlenÚstrÚdatetimeÚ    timedeltar/Ú timedelta64r ÚanyrLÚ_deltasrr-r:Ú_comÚonesrXÚshaperSrD)ÚselfrXrOr4r5r6rPrQrRrSrHrTrVÚ times_dtypeÚ    __class__s              €r9r]z ExponentialMovingWindow.__init__Ps1ø€ô     ‰ÑØØ(Ð0™´c¼#¸kÓ:JÈAÓ6NØØØØØØð    ô        
ðˆŒØˆŒ    Ø ˆŒ ؈Œ
؈Œ Ø"ˆŒØˆŒ
Ø :‰:Ñ !Ø—;’;Ü)Ð*UÓVÐVÜ! $§*¡*¨g°tÓ<ˆKä# KÔ0ܘk¬?Ô;ä Ð!BÓCÐCܐ4—:‘:‹¤# c£(Ò*Ü Ð!OÓPÐPܘdŸm™m¬c´8×3EÑ3EÄrÇ~Á~Ð-VÔWÜ Ð!RÓSÐSܐD—J‘JÓ×#Ñ#Ô%Ü Ð!GÓHÐHÜ,¨T¯Z©Z¸¿¹ÓGˆDŒLô×$Ñ$ T§X¡X¨t¯y©y¸$¿*¹*ÓEÈÒIÜ.¨t¯x©x¸¿¹ÀDÈ$Ï*É*ÓU•    à•    à}‰}Ð(¬ZØ— ‘ ¤¤X×%7Ñ%7¼¿¹ÐHô.ô!ð)óðô
Ÿ7™7ܐD—H‘H—N‘N 4§9¡9Ñ-°Ñ1°1Ó5¼R¿Z¹ZôˆDŒLô+ð—‘Ø—    ‘    Ø— ‘ Ø—
‘
óˆDIr;có—y©N©)rlÚstartÚendÚnum_valss    r9Ú_check_window_boundsz,ExponentialMovingWindow._check_window_boundss€ð
     r;có—t«S)z[
        Return an indexer class that will compute the window start and end bounds
        )r©rls r9Ú_get_window_indexerz+ExponentialMovingWindow._get_window_indexer¤s €ô.Ó/Ð/r;có—t|j|j|j|j|j
|j |j|j|j|j|||j¬« S)aª
        Return an ``OnlineExponentialMovingWindow`` object to calculate
        exponentially moving window aggregations in an online method.
 
        .. versionadded:: 1.3.0
 
        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
        ) rXrOr4r5r6rPrQrRrSrHÚengineÚ engine_kwargsrV) ÚOnlineExponentialMovingWindowrXrOr4r5r6rPrQrRrSrHÚ
_selection)rlrzr{s   r9ÚonlinezExponentialMovingWindow.onlineªsf€ô8-Ø—‘Ø—‘Ø—‘Ø—]‘]Ø—*‘*Ø×(Ñ(Ø—;‘;Ø—n‘nØ—‘Ø—*‘*ØØ'Ø—o‘oô
ð    
r;Ú    aggregatezV
        See Also
        --------
        pandas.DataFrame.rolling.aggregate
        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ÚklassrScó*•—t‰||g|¢­i|¤ŽSrp)r\r)rlÚfuncÚargsÚkwargsrns    €r9rz!ExponentialMovingWindow.aggregateÖsø€ô>‰wÑ  Ð7¨Ò7°Ñ7Ð7r;Ú
ParametersÚReturnszSee AlsoÚNotesÚExampleszÆ        >>> ser = pd.Series([1, 2, 3, 4])
        >>> ser.ewm(alpha=.2).mean()
        0    1.000000
        1    1.555556
        2    2.147541
        3    2.775068
        dtype: float64
        Úewmz"(exponential weighted moment) meanÚmean)Ú window_methodÚaggregation_descriptionÚ
agg_methodc
ó—t|«ry|jdk(rt}nt}|d
it    |«¤|j
|j |jt|j«ddœ¤Ž}|j|d¬«S|dvrx| td«‚|j€dn |j}ttj|j
|j |j|d¬«}|j|d|¬«Std    «‚) NÚsingleT©rOrQrRÚdeltasÚ    normalizer©Úname©ÚcythonNú+cython engine does not accept engine_kwargs©r—Ú numeric_onlyú)engine must be either 'numba' or 'cython'rq)rrTrrrrirQrRÚtuplerhÚ_applyr.rHrÚwindow_aggregationsrŒ©rlrœrzr{r…Úewm_funcr”Ú window_funcs        r9rzExponentialMovingWindow.meanùsø€ôB ˜6Ô "؏{‰{˜hÒ&Ü.‘ä4ÙñÜ# MÓ2ðà—I‘IØ—{‘{ØŸ.™.ܘTŸ\™\Ó*Øó ˆHð—;‘;˜x¨f;Ó5Ð 5Ø Ð'Ñ 'ØÐ(Ü Ð!NÓOÐOà!ŸZ™ZÐ/‘T°T·\±\ˆFÜ!Ü#×'Ñ'Ø—I‘IØ—{‘{ØŸ.™.ØØô ˆKð—;‘;˜{°Àl;ÓSÐ SäÐHÓIÐ Ir;z¹        >>> ser = pd.Series([1, 2, 3, 4])
        >>> ser.ewm(alpha=.2).sum()
        0    1.000
        1    2.800
        2    5.240
        3    8.192
        dtype: float64
        z!(exponential weighted moment) sumÚsumc
óF—|js td«‚t|«ry|jdk(rt}nt
}|d it |«¤|j|j|jt|j«ddœ¤Ž}|j|d¬«S|dvrx| td«‚|j€dn |j}ttj |j|j|j|d¬«}|j|d|¬    «Std
«‚) Nz(sum is not implemented with adjust=Falser’Fr“r¤r–r˜ršr›rrq)rQr`rrTrrrrirRržrhrŸr.rHrr rŒr¡s        r9r¤zExponentialMovingWindow.sum9s €ðB{Š{Ü%Ð&PÓQÐ QÜ ˜6Ô "؏{‰{˜hÒ&Ü.‘ä4ÙñÜ# MÓ2ðà—I‘IØ—{‘{ØŸ.™.ܘTŸ\™\Ó*Øó ˆHð—;‘;˜x¨e;Ó4Ð 4Ø Ð'Ñ 'ØÐ(Ü Ð!NÓOÐOà!ŸZ™ZÐ/‘T°T·\±\ˆFÜ!Ü#×'Ñ'Ø—I‘IØ—{‘{ØŸ.™.ØØô ˆKð—;‘;˜{°À\;ÓRÐ RäÐHÓIÐ Ir;zb        bias : bool, default False
            Use a standard estimation bias correction.
        zÅ        >>> ser = pd.Series([1, 2, 3, 4])
        >>> ser.ewm(alpha=.2).std()
        0         NaN
        1    0.707107
        2    0.995893
        3    1.277320
        dtype: float64
        z0(exponential weighted moment) standard deviationÚstdcóð—|rY|jjdk(r@t|jj«s!t    t |«j ›d«‚t|j||¬««S)Nr+z$.std does not implement numeric_only)Úbiasrœ)    Ú _selected_objÚndimr
r>r`ÚtypeÚ__name__rÚvar©rlr¨rœs   r9r¦zExponentialMovingWindow.std{so€ñ@ Ø×"Ñ"×'Ñ'¨1Ò,Ü$ T×%7Ñ%7×%=Ñ%=Ô>ô&ܘ“:×&Ñ&Ð'Ð'KÐLóð ôT—X‘X 4°lXÓCÓDÐDr;zÅ        >>> ser = pd.Series([1, 2, 3, 4])
        >>> ser.ewm(alpha=.2).var()
        0         NaN
        1    0.500000
        2    0.991803
        3    1.631547
        dtype: float64
        z&(exponential weighted moment) variancer­c󲇗tj}t||j|j|j
|¬«Šˆfd„}|j |d|¬«S)N)rOrQrRr¨có•—‰|||||«Srprq)ÚvaluesÚbeginrsrPÚwfuncs    €r9Úvar_funcz-ExponentialMovingWindow.var.<locals>.var_funcÍsø€Ù˜ ¨¨[¸&ÓAÐ Ar;r­r›)r ÚewmcovrrirQrRrŸ)rlr¨rœr£r´r³s     @r9r­zExponentialMovingWindow.var¥sRø€ô>*×0Ñ0ˆ ÜØ Ø—    ‘    Ø—;‘;Ø—n‘nØô 
ˆô    Bð{‰{˜8¨%¸lˆ{ÓKÐKr;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 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.
        zú        >>> ser1 = pd.Series([1, 2, 3, 4])
        >>> ser2 = pd.Series([10, 11, 13, 16])
        >>> ser1.ewm(alpha=.2).cov(ser2)
        0         NaN
        1    0.500000
        2    1.524590
        3    3.408836
        dtype: float64
        z/(exponential weighted moment) sample covarianceÚcovc󄇇‡—ddlmЉjd|«ˆˆˆfd„}‰j‰j||||«S)Nr©r(r¶c óú•—‰ j|«}‰ j|«}‰ j«}‰ j ‰ jn |j}|j    t |«|‰ j ‰ j‰ j¬«\}}tj|||‰ j|‰ j‰ j‰ j‰
«    }‰    ||j|jd¬«S)N©Ú
num_valuesrPrZr[ÚstepF©Úindexr—Úcopy)Ú _prep_valuesrxrPÚ window_sizeÚget_window_boundsrbrZr[r¼r rµrirQrRr¾r—) ÚxÚyÚx_arrayÚy_arrayÚwindow_indexerrPrrrsÚresultr(r¨rls          €€€r9Úcov_funcz-ExponentialMovingWindow.cov.<locals>.cov_funcsîø€Ø×'Ñ'¨Ó*ˆGØ×'Ñ'¨Ó*ˆGØ!×5Ñ5Ó7ˆNð×#Ñ#Ð/ð× Ò à#×/Ñ/ð ð
(×9Ñ9ܘw›<Ø'Ø—{‘{Ø—{‘{Ø—Y‘Yð :ó‰JˆE3ô)×/Ñ/ØØØð× Ñ ØØ—    ‘    Ø— ‘ Ø—‘Øó ˆFñ˜&¨¯©°a·f±fÀ5ÔIÐ Ir;©Úpandasr(Ú_validate_numeric_onlyÚ_apply_pairwiser©)rlÚotherÚpairwiser¨rœrÉr(s`  `  @r9r¶zExponentialMovingWindow.covÒsEú€õ`    "à ×#Ñ# E¨<Ô8ö    Jð>×#Ñ#Ø × Ñ   x°¸<ó
ð    
r;aK        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.
        zû        >>> ser1 = pd.Series([1, 2, 3, 4])
        >>> ser2 = pd.Series([10, 11, 13, 16])
        >>> ser1.ewm(alpha=.2).corr(ser2)
        0         NaN
        1    1.000000
        2    0.982821
        3    0.977802
        dtype: float64
        z0(exponential weighted moment) sample correlationÚcorrc󀇇—ddlmЉjd|«ˆˆfd„}‰j‰j||||«S)Nrr¸rÐcó4•‡
‡ ‡ —‰j|«}‰j|«}‰j«}‰j ‰jn |jŠ |j    t |«‰ ‰j ‰j‰j¬«\Š Š
ˆ
ˆ ˆˆ fd„}tjd¬«5|||«}|||«}|||«}|t||z«z }    ddd«‰     |j|jd¬«S#1swYŒ)xYw)Nrºc óz•—tj|‰‰‰|‰j‰j‰jd«    S)NT)r rµrirQrR)ÚXÚYrsrPrlrrs  €€€€r9Ú_covz<ExponentialMovingWindow.corr.<locals>.cov_func.<locals>._covks=ø€Ü*×1Ñ1ØØØØØØ—I‘IØ—K‘KØ—N‘NØó
ð
r;Úignore)ÚallFr½)rÀrxrPrÁrÂrbrZr[r¼r/Úerrstaterr¾r—)rÃrÄrÅrÆrÇrÖr¶Úx_varÚy_varrÈrsrPrrr(rls          @@@€€r9rÉz.ExponentialMovingWindow.corr.<locals>.cov_funcZs û€Ø×'Ñ'¨Ó*ˆGØ×'Ñ'¨Ó*ˆGØ!×5Ñ5Ó7ˆNð×#Ñ#Ð/ð× Ò à#×/Ñ/ð ð
(×9Ñ9ܘw›<Ø'Ø—{‘{Ø—{‘{Ø—Y‘Yð :ó‰JˆE3÷ ô—‘ Ô*ñ 4Ù˜7 GÓ,Ù˜W gÓ.Ù˜W gÓ.Øœu U¨U¡]Ó3Ñ3÷     4ñ
˜&¨¯©°a·f±fÀ5ÔIÐ I÷  4ð 4ús Â9-DÄDrÊ)rlrÎrÏrœrÉr(s`    @r9rÐzExponentialMovingWindow.corr)sFù€õZ    "à ×#Ñ# F¨LÔ9õ#    JðJ×#Ñ#Ø × Ñ   x°¸<ó
ð    
r;)
NNNNrTFrNr’)rXr)rOú float | Noner4rÜr5ú(float | TimedeltaConvertibleTypes | Noner6rÜrPú
int | NonerQÚboolrRrßrSr$rHúnp.ndarray | NDFrame | NonerTrcÚreturnÚNone)rrú
np.ndarrayrsrãrtr_rárâ)rár)ÚnumbaN)rzrcrár|)FNN)rœrß©FF©r¨rßrœrß©NNFF©rÎúDataFrame | Series | NonerÏú bool | Noner¨rßrœrß©NNF©rÎrérÏrêrœrß)r¬Ú
__module__Ú __qualname__Ú__doc__Ú _attributesr]rurxr~rrrrÚaggrrrrrrrrr¤r¦r­r¶rÐÚ __classcell__©rns@r9rNrN…svø„ñ{òz €Kð !Ø!Ø=AØ"Ø"#ØØØØ-1ØðKðñKà ðKððKðð    Kð
;ð Kð ð Kð ðKððKððKððKð+ðKððKð
õKðZ Øð Ø&0ð Ø<?ð à     ó ó0ð48ð*
Øð*
à    &ó*
ñX    Ø[Ñ!Ùð ó
ñð ó
ð$!Ø ô9ó<8ó=ð<8ð €CáØÙ˜lÓ+ØÙ#Ó%Ù˜iÓ(ØÙ˜jÓ)ØÙ˜gÓ&ØÙ˜jÓ)Ùð ó
    
ðØ DØô3ð:#ØØð    #Jàò#Jó7ð6#JñJ    ØÙ˜lÓ+ØÙ#Ó%Ù˜iÓ(ØÙ˜jÓ)ØÙ˜gÓ&ØÙ˜jÓ)Ùð ó
    
ðØ CØô3ð:#ØØð    %Jàò%Jó7ð6%JñN    ØÙ˜lÓ+Ùð ó    
ð     Ù˜iÓ(ØÙ˜jÓ)ØÙ˜jÓ)Ùð ó
    
ðØ RØô9ó<
Eó=ð<
Eñ    ØÙ˜lÓ+Ùð ó    
ð     Ù˜iÓ(ØÙ˜jÓ)ØÙ˜jÓ)Ùð ó
    
ðØ HØô9ó< Ló=ð< Lñ    ØÙ˜lÓ+Ùð ó    
ð     Ù˜iÓ(ØÙ˜jÓ)ØÙ˜jÓ)Ùð     ó     
ðØ QØôO(ðV,0Ø $ØØ"ð ,
à(ð,
ðð,
ðð    ,
ð
ò ,
óS(ðR,
ñ\    ØÙ˜lÓ+Ùð ó     
ð    Ù˜iÓ(ØÙ˜jÓ)ØÙ˜jÓ)Ùð     ó     
ðØ RØôK&ðR,0Ø $Ø"ð    1
à(ð1
ðð1
ðò    1
óO&ôN1
r;rNcód‡—eZdZdZej
ej
zZddœdˆfd„Zdd„ZˆxZ    S)ÚExponentialMovingWindowGroupbyzF
    Provide an exponential moving window groupby implementation.
    N)Ú_groupercóL•—t‰||g|¢­d|i|¤Ž|js‚|jut    j
t |jjj«««}t|jj|«|j«|_ yyy)Nrö)r\r]ÚemptyrHr/Ú concatenateÚliströÚindicesr±rLÚtaker5rh)rlrXrör†r‡Ú groupby_orderrns      €r9r]z'ExponentialMovingWindowGroupby.__init__‹sø€Ü ‰Ñ˜ÐA˜tÒA¨hÐA¸&ÒAàyŠy˜TŸZ™ZÐ3äŸN™N¬4°· ± ×0EÑ0E×0LÑ0LÓ0NÓ+OÓPˆMÜ,Ø—
‘
—‘  Ó.Ø— ‘ óˆDLð4ˆyr;cóP—t|jjt¬«}|S)z“
        Return an indexer class that will compute the window start and end bounds
 
        Returns
        -------
        GroupbyIndexer
        )Úgroupby_indicesrÇ)rrörûr)rlrÇs  r9rxz2ExponentialMovingWindowGroupby._get_window_indexer–s&€ô(Ø ŸM™M×1Ñ1Ü9ô
ˆðÐr;©rárâ)rár)
r¬rírîrïrNrðr#r]rxròrós@r9rõrõ„s.ø„ñð*×5Ñ5Ð8I×8UÑ8UÑU€Kà,0÷    ÷ r;rõcóڇ—eZdZ                                            d ddœ                                                                                                    d ˆfd„Zdd„Zd„Zddd„Z            d                    dd„Z                d                            dd„Zddd    „Z    ddd
œd „Z
ˆxZ S)r|NrUc  ó(•—|
 td«‚t‰|    |||||||||    |
| ¬« t|j|j
|j |j|j«|_    t| «r| |_ | |_ ytd«‚)Nz0times is not implemented with online operations.) rXrOr4r5r6rPrQrRrSrHrVz$'numba' is the only supported engine)r`r\r]r rirQrRrSrkÚ_meanrrzr{r.)rlrXrOr4r5r6rPrQrRrSrHrzr{rVrns              €r9r]z&OnlineExponentialMovingWindow.__init__¦s¢ø€ð" Ð Ü%ØBóð ô    ‰ÑØØØØØØ#ØØØØØð    ô     
ô"Ø I‰It—{‘{ D§N¡N°D·I±I¸s¿y¹yó
ˆŒ
ô ˜6Ô "Ø ˆDŒKØ!.ˆDÕ äÐCÓDÐ Dr;có8—|jj«y)z=
        Reset the state captured by `update` calls.
        N)rÚresetrws r9rz#OnlineExponentialMovingWindow.resetÑs€ð     
‰
×ÑÕr;có—td«‚)Nzaggregate is not implemented.©r`)rlr…r†r‡s    r9rz'OnlineExponentialMovingWindow.aggregate×s€Ü!Ð"AÓBÐBr;có—td«‚)Nzstd is not implemented.r)rlr¨r†r‡s    r9r¦z!OnlineExponentialMovingWindow.stdÚó€Ü!Ð";Ó<Ð<r;có—td«‚)Nzcorr is not implemented.r)rlrÎrÏrœs    r9rÐz"OnlineExponentialMovingWindow.corrÝs€ô "Ð"<Ó=Ð=r;có—td«‚)Nzcov is not implemented.r)rlrÎrÏr¨rœs     r9r¶z!OnlineExponentialMovingWindow.covås€ô"Ð";Ó<Ð<r;có—td«‚)Nzvar is not implemented.rr®s   r9r­z!OnlineExponentialMovingWindow.varîr    r;)ÚupdateÚ update_timescó²—i}|jjdk(}| td«‚tjt |jj |jdz
dz
d«tj¬«}|º|jj€ td«‚d}|j|d<|r;|jjtjdd…f}    |j|d    <n%|jj}    |j|d
<tj |    |j#«f«}
n‰d}|jj|d<|r|jj|d    <n|jj|d
<|jj%tjd ¬ «j#«}
t'd it)|j*«¤Ž} |jj-|r|
n|
dd…tjf||j.| «} |s| j1«} | |d} |jj2| fi|¤Ž} | S)a[
        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
        r,Nz update_times is not implemented.r+rr=z;Must call mean with update=None first before passing updater¾Úcolumnsr—F)r¿rq)r©rªr`r/rjr^rkrSrDrÚlast_ewmr.r¾Únewaxisrr—rùÚto_numpyÚastyper!rr{Úrun_ewmrPÚsqueezeÚ _constructor) rlr rr†r‡Ú result_kwargsÚis_frameÚ update_deltasÚ result_fromÚ
last_valueÚnp_arrayÚ    ewma_funcrÈs              r9rz"OnlineExponentialMovingWindow.meanñs€ðXˆ Ø×%Ñ%×*Ñ*¨aÑ/ˆØ Ð #Ü%Ð&HÓIÐ IÜŸ™Ü ×"Ñ"×(Ñ(¨¯©°Q©Ñ7¸!Ñ;¸QÓ ?ÄrÇzÁzô
ˆ ð Р؏z‰z×"Ñ"Ð*Ü ØQóððˆKØ%+§\¡\ˆM˜'Ñ "ÙØ!ŸZ™Z×0Ñ0´·±ºQ°Ñ?
Ø+1¯>©> ˜iÒ(à!ŸZ™Z×0Ñ0
Ø(.¯ ©  ˜fÑ%Ü—~‘~ z°6·?±?Ó3DÐ&EÓF‰HàˆKØ%)×%7Ñ%7×%=Ñ%=ˆM˜'Ñ "ÙØ+/×+=Ñ+=×+EÑ+E ˜iÒ(à(,×(:Ñ(:×(?Ñ(? ˜fÑ%Ø×)Ñ)×0Ñ0´·±À%Ð0ÓH×QÑQÓSˆHÜ3ñ
Ü × 2Ñ 2Ó3ñ
ˆ    ð—‘×#Ñ#Ù ‰H hªq´"·*±*¨}Ñ&=Ø Ø × Ñ Ø ó    
ˆñ Ø—^‘^Ó%ˆFؘ ˜ Ð%ˆØ0×#Ñ#×0Ñ0°ÑI¸=ÑIˆØˆ r;) NNNNrTFrNräN)rXr)rOrÜr4rÜr5rÝr6rÜrPrÞrQrßrRrßrSr$rHràrzrcr{zdict[str, bool] | Nonerárâr)F)r¨rßrërìrçrèråræ) r¬rírîr]rrr¦rÐr¶r­rròrós@r9r|r|¥sRø„ð!Ø!Ø=AØ"Ø"#ØØØØ-1ØØ04ð)Eðñ)Eà ð)Eðð)Eðð    )Eð
;ð )Eð ð )Eð ð)Eðð)Eðð)Eðð)Eð+ð)Eðð)Eð.ð)Eð 
õ!)EóVò Cô=ð
,0Ø $Ø"ð    >à(ð>ðð>ðó    >ð,0Ø $ØØ"ð =à(ð=ðð=ðð    =ð
ó =ô=ð"&°D÷VðVr;r|)
r3rÜr4rÜr5rÜr6rÜrár2)rHznp.ndarray | NDFramer5rÝráznpt.NDArray[np.float64])JÚ
__future__rrdÚ    functoolsrÚtextwraprÚtypingrÚnumpyr/Ú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.objectsrrrÚpandas.core.util.numba_rrÚpandas.core.window.commonrÚpandas.core.window.docrrrrrrrrÚpandas.core.window.numba_rrÚpandas.core.window.onliner r!Úpandas.core.window.rollingr"r#Úpandas._typingr$r%r&rËr'r(Úpandas.core.genericr)r:rLrNrõr|rqr;r9ú<module>r9sðÝ"ãÝÝÝ ãå)ß>Ó>Ý'÷õ6Ý0Ý+åÝ9÷ñ÷
õ,÷    ÷    ó    ÷÷÷ñ
÷ñ÷ õ,ðØ ðà
ðððð ð    ð
 ó ðB'Ø ð'à6ð'ðó'ô:| 
˜jô| 
ô~Ð%6Ð8OôôBbÐ$;õbr;