zmc
2023-12-22 9fdbf60165db0400c2e8e6be2dc6e88138ac719a
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
U
¬ý°dÆ
ã@sÂdZddlmZddlmZddlZddlmZddl    m
Z
m Z m Z ddœd    d
d d d œdd„Z ddœd
d d dœdd„Zddœd
d d dœdd„Zddœd
d d dœdd„Zddœd
d d dœdd„ZdS)zh
masked_accumulations.py is for accumulation algorithms using a mask-based approach
for missing values.
é)Ú annotations)ÚCallableN)Únpt)Ú is_bool_dtypeÚis_float_dtypeÚis_integer_dtypeT©Úskipnarz
np.ndarrayznpt.NDArray[np.bool_]Úbool)ÚfuncÚvaluesÚmaskr    cCsÒt|ƒrt |jj¡}n@t|ƒr0t |jj¡}n(t|ƒrFt tj¡}nt    d|jj›ƒ‚z,tj
dtj j |j tjdtjj |ji|}Wn$tk
r¨t    d|›dƒ‚YnX|||<|sÂtj   |¡}||ƒ}||fS)aù
    Accumulations for 1D masked array.
 
    We will modify values in place to replace NAs with the appropriate fill value.
 
    Parameters
    ----------
    func : np.cumsum, np.cumprod, np.maximum.accumulate, np.minimum.accumulate
    values : np.ndarray
        Numpy array with the values (can be of any dtype that support the
        operation).
    mask : np.ndarray
        Boolean numpy array (True values indicate missing values).
    skipna : bool, default True
        Whether to skip NA.
    z)No masked accumulation defined for dtype érzNo accumulation for z implemented on BaseMaskedArray)rÚnpZfinfoZdtypeÚtyperZiinforZuint8ÚNotImplementedErrorÚcumprodÚmaximumÚ
accumulateÚminÚcumsumÚminimumÚmaxÚKeyError)r r r r    Z
dtype_infoZ
fill_value©rúcd:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/core/array_algos/masked_accumulations.pyÚ    _cum_funcs< ÿüû
ÿ
 r©r r r    cCsttj|||dS©Nr)rrrrrrrrOsrcCsttj|||dSr)rrrrrrrrSsrcCsttjj|||dSr)rrrrrrrrÚcumminWsrcCsttjj|||dSr)rrrrrrrrÚcummax[sr )Ú__doc__Ú
__future__rÚtypingrÚnumpyrZpandas._typingrZpandas.core.dtypes.commonrrrrrrrr rrrrÚ<module>s    û: