Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +8 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/arrays.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/hashing.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/index.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/parsers.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/sas.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/_libs/writers.cpython-310-x86_64-linux-gnu.so +3 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/accessor.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/algorithms.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/api.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/apply.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/arraylike.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/base.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/common.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/config_init.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/construction.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/flags.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/indexing.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/missing.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/nanops.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/resample.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/roperator.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/sample.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/shared_docs.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/__pycache__/sorting.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/mean_.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/min_max_.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/shared.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/sum_.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/var_.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/shared.py +29 -0
- mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/sum_.py +244 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__init__.py +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/__init__.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/align.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/api.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/check.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/common.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/engines.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/eval.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/expr.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/expressions.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/ops.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/parsing.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/pytables.cpython-310.pyc +0 -0
- mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/scope.cpython-310.pyc +0 -0
.gitattributes
CHANGED
|
@@ -1102,3 +1102,11 @@ mgm/lib/python3.10/site-packages/altair/vegalite/v5/schema/__pycache__/channels.
|
|
| 1102 |
openflamingo/lib/python3.10/site-packages/torch/lib/libcudnn_cnn_train.so.8 filter=lfs diff=lfs merge=lfs -text
|
| 1103 |
mgm/lib/python3.10/site-packages/altair/vegalite/v5/schema/__pycache__/core.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1104 |
mgm/lib/python3.10/site-packages/altair/vegalite/v5/schema/__pycache__/_config.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1102 |
openflamingo/lib/python3.10/site-packages/torch/lib/libcudnn_cnn_train.so.8 filter=lfs diff=lfs merge=lfs -text
|
| 1103 |
mgm/lib/python3.10/site-packages/altair/vegalite/v5/schema/__pycache__/core.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1104 |
mgm/lib/python3.10/site-packages/altair/vegalite/v5/schema/__pycache__/_config.cpython-310.pyc filter=lfs diff=lfs merge=lfs -text
|
| 1105 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1106 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/sas.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1107 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/arrays.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1108 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/parsers.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1109 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/writers.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1110 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1111 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/hashing.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
| 1112 |
+
mgm/lib/python3.10/site-packages/pandas/_libs/index.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
mgm/lib/python3.10/site-packages/pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e428449e985790af8faa2227d6c2c989c54cc093110f476200d68f36b4a524df
|
| 3 |
+
size 2194056
|
mgm/lib/python3.10/site-packages/pandas/_libs/arrays.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d7d4536852551fda02d7d1b2d2f4aaf559877db06a6a40e8d5fa73bc0e1d048c
|
| 3 |
+
size 133184
|
mgm/lib/python3.10/site-packages/pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:41230fbdf558575fed8f6530dbc235130d3792987366204e2c417b04eb0da552
|
| 3 |
+
size 2601544
|
mgm/lib/python3.10/site-packages/pandas/_libs/hashing.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aaa580f281abd4927103eb650b5862847f009d36cac26208f065eafec29d2fa4
|
| 3 |
+
size 221160
|
mgm/lib/python3.10/site-packages/pandas/_libs/index.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b7c4ebb97b90fed30f3c3a62d1b4157dd99a13aad68363e8f4362f30baa1ba3c
|
| 3 |
+
size 988040
|
mgm/lib/python3.10/site-packages/pandas/_libs/parsers.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c9e1a4899b63e3a9a6431882897273d1797a9c2d2baff27406c8b8211eceaf34
|
| 3 |
+
size 594760
|
mgm/lib/python3.10/site-packages/pandas/_libs/sas.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:11b3311641252cc3594a0baad029d4d5df8bbafa951fe11ff3871d3a4488f924
|
| 3 |
+
size 267112
|
mgm/lib/python3.10/site-packages/pandas/_libs/writers.cpython-310-x86_64-linux-gnu.so
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c991c235b77eff83b7507b7c24e05df401c83bc4c7d8558a7fdb819bfc6cea6b
|
| 3 |
+
size 258952
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (160 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/accessor.cpython-310.pyc
ADDED
|
Binary file (11.2 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/algorithms.cpython-310.pyc
ADDED
|
Binary file (39.6 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/api.cpython-310.pyc
ADDED
|
Binary file (2.6 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/apply.cpython-310.pyc
ADDED
|
Binary file (49.8 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/arraylike.cpython-310.pyc
ADDED
|
Binary file (14.4 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/base.cpython-310.pyc
ADDED
|
Binary file (37.8 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/common.cpython-310.pyc
ADDED
|
Binary file (17.1 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/config_init.cpython-310.pyc
ADDED
|
Binary file (20.6 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/construction.cpython-310.pyc
ADDED
|
Binary file (19.7 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/flags.cpython-310.pyc
ADDED
|
Binary file (4.32 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/indexing.cpython-310.pyc
ADDED
|
Binary file (68.7 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/missing.cpython-310.pyc
ADDED
|
Binary file (26.6 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/nanops.cpython-310.pyc
ADDED
|
Binary file (36.9 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/resample.cpython-310.pyc
ADDED
|
Binary file (74.8 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/roperator.cpython-310.pyc
ADDED
|
Binary file (1.79 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/sample.cpython-310.pyc
ADDED
|
Binary file (3.95 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/shared_docs.cpython-310.pyc
ADDED
|
Binary file (30.2 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/__pycache__/sorting.cpython-310.pyc
ADDED
|
Binary file (19.9 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (607 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/mean_.cpython-310.pyc
ADDED
|
Binary file (3.47 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/min_max_.cpython-310.pyc
ADDED
|
Binary file (2.43 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/shared.cpython-310.pyc
ADDED
|
Binary file (766 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/sum_.cpython-310.pyc
ADDED
|
Binary file (3.79 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/var_.cpython-310.pyc
ADDED
|
Binary file (3.93 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/shared.py
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
from typing import TYPE_CHECKING
|
| 4 |
+
|
| 5 |
+
import numba
|
| 6 |
+
|
| 7 |
+
if TYPE_CHECKING:
|
| 8 |
+
import numpy as np
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
@numba.jit(
|
| 12 |
+
# error: Any? not callable
|
| 13 |
+
numba.boolean(numba.int64[:]), # type: ignore[misc]
|
| 14 |
+
nopython=True,
|
| 15 |
+
nogil=True,
|
| 16 |
+
parallel=False,
|
| 17 |
+
)
|
| 18 |
+
def is_monotonic_increasing(bounds: np.ndarray) -> bool:
|
| 19 |
+
"""Check if int64 values are monotonically increasing."""
|
| 20 |
+
n = len(bounds)
|
| 21 |
+
if n < 2:
|
| 22 |
+
return True
|
| 23 |
+
prev = bounds[0]
|
| 24 |
+
for i in range(1, n):
|
| 25 |
+
cur = bounds[i]
|
| 26 |
+
if cur < prev:
|
| 27 |
+
return False
|
| 28 |
+
prev = cur
|
| 29 |
+
return True
|
mgm/lib/python3.10/site-packages/pandas/core/_numba/kernels/sum_.py
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Numba 1D sum kernels that can be shared by
|
| 3 |
+
* Dataframe / Series
|
| 4 |
+
* groupby
|
| 5 |
+
* rolling / expanding
|
| 6 |
+
|
| 7 |
+
Mirrors pandas/_libs/window/aggregation.pyx
|
| 8 |
+
"""
|
| 9 |
+
from __future__ import annotations
|
| 10 |
+
|
| 11 |
+
from typing import (
|
| 12 |
+
TYPE_CHECKING,
|
| 13 |
+
Any,
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
import numba
|
| 17 |
+
from numba.extending import register_jitable
|
| 18 |
+
import numpy as np
|
| 19 |
+
|
| 20 |
+
if TYPE_CHECKING:
|
| 21 |
+
from pandas._typing import npt
|
| 22 |
+
|
| 23 |
+
from pandas.core._numba.kernels.shared import is_monotonic_increasing
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
@numba.jit(nopython=True, nogil=True, parallel=False)
|
| 27 |
+
def add_sum(
|
| 28 |
+
val: Any,
|
| 29 |
+
nobs: int,
|
| 30 |
+
sum_x: Any,
|
| 31 |
+
compensation: Any,
|
| 32 |
+
num_consecutive_same_value: int,
|
| 33 |
+
prev_value: Any,
|
| 34 |
+
) -> tuple[int, Any, Any, int, Any]:
|
| 35 |
+
if not np.isnan(val):
|
| 36 |
+
nobs += 1
|
| 37 |
+
y = val - compensation
|
| 38 |
+
t = sum_x + y
|
| 39 |
+
compensation = t - sum_x - y
|
| 40 |
+
sum_x = t
|
| 41 |
+
|
| 42 |
+
if val == prev_value:
|
| 43 |
+
num_consecutive_same_value += 1
|
| 44 |
+
else:
|
| 45 |
+
num_consecutive_same_value = 1
|
| 46 |
+
prev_value = val
|
| 47 |
+
|
| 48 |
+
return nobs, sum_x, compensation, num_consecutive_same_value, prev_value
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
@numba.jit(nopython=True, nogil=True, parallel=False)
|
| 52 |
+
def remove_sum(
|
| 53 |
+
val: Any, nobs: int, sum_x: Any, compensation: Any
|
| 54 |
+
) -> tuple[int, Any, Any]:
|
| 55 |
+
if not np.isnan(val):
|
| 56 |
+
nobs -= 1
|
| 57 |
+
y = -val - compensation
|
| 58 |
+
t = sum_x + y
|
| 59 |
+
compensation = t - sum_x - y
|
| 60 |
+
sum_x = t
|
| 61 |
+
return nobs, sum_x, compensation
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
@numba.jit(nopython=True, nogil=True, parallel=False)
|
| 65 |
+
def sliding_sum(
|
| 66 |
+
values: np.ndarray,
|
| 67 |
+
result_dtype: np.dtype,
|
| 68 |
+
start: np.ndarray,
|
| 69 |
+
end: np.ndarray,
|
| 70 |
+
min_periods: int,
|
| 71 |
+
) -> tuple[np.ndarray, list[int]]:
|
| 72 |
+
dtype = values.dtype
|
| 73 |
+
|
| 74 |
+
na_val: object = np.nan
|
| 75 |
+
if dtype.kind == "i":
|
| 76 |
+
na_val = 0
|
| 77 |
+
|
| 78 |
+
N = len(start)
|
| 79 |
+
nobs = 0
|
| 80 |
+
sum_x = 0
|
| 81 |
+
compensation_add = 0
|
| 82 |
+
compensation_remove = 0
|
| 83 |
+
na_pos = []
|
| 84 |
+
|
| 85 |
+
is_monotonic_increasing_bounds = is_monotonic_increasing(
|
| 86 |
+
start
|
| 87 |
+
) and is_monotonic_increasing(end)
|
| 88 |
+
|
| 89 |
+
output = np.empty(N, dtype=result_dtype)
|
| 90 |
+
|
| 91 |
+
for i in range(N):
|
| 92 |
+
s = start[i]
|
| 93 |
+
e = end[i]
|
| 94 |
+
if i == 0 or not is_monotonic_increasing_bounds:
|
| 95 |
+
prev_value = values[s]
|
| 96 |
+
num_consecutive_same_value = 0
|
| 97 |
+
|
| 98 |
+
for j in range(s, e):
|
| 99 |
+
val = values[j]
|
| 100 |
+
(
|
| 101 |
+
nobs,
|
| 102 |
+
sum_x,
|
| 103 |
+
compensation_add,
|
| 104 |
+
num_consecutive_same_value,
|
| 105 |
+
prev_value,
|
| 106 |
+
) = add_sum(
|
| 107 |
+
val,
|
| 108 |
+
nobs,
|
| 109 |
+
sum_x,
|
| 110 |
+
compensation_add,
|
| 111 |
+
num_consecutive_same_value,
|
| 112 |
+
prev_value,
|
| 113 |
+
)
|
| 114 |
+
else:
|
| 115 |
+
for j in range(start[i - 1], s):
|
| 116 |
+
val = values[j]
|
| 117 |
+
nobs, sum_x, compensation_remove = remove_sum(
|
| 118 |
+
val, nobs, sum_x, compensation_remove
|
| 119 |
+
)
|
| 120 |
+
|
| 121 |
+
for j in range(end[i - 1], e):
|
| 122 |
+
val = values[j]
|
| 123 |
+
(
|
| 124 |
+
nobs,
|
| 125 |
+
sum_x,
|
| 126 |
+
compensation_add,
|
| 127 |
+
num_consecutive_same_value,
|
| 128 |
+
prev_value,
|
| 129 |
+
) = add_sum(
|
| 130 |
+
val,
|
| 131 |
+
nobs,
|
| 132 |
+
sum_x,
|
| 133 |
+
compensation_add,
|
| 134 |
+
num_consecutive_same_value,
|
| 135 |
+
prev_value,
|
| 136 |
+
)
|
| 137 |
+
|
| 138 |
+
if nobs == 0 == min_periods:
|
| 139 |
+
result: object = 0
|
| 140 |
+
elif nobs >= min_periods:
|
| 141 |
+
if num_consecutive_same_value >= nobs:
|
| 142 |
+
result = prev_value * nobs
|
| 143 |
+
else:
|
| 144 |
+
result = sum_x
|
| 145 |
+
else:
|
| 146 |
+
result = na_val
|
| 147 |
+
if dtype.kind == "i":
|
| 148 |
+
na_pos.append(i)
|
| 149 |
+
|
| 150 |
+
output[i] = result
|
| 151 |
+
|
| 152 |
+
if not is_monotonic_increasing_bounds:
|
| 153 |
+
nobs = 0
|
| 154 |
+
sum_x = 0
|
| 155 |
+
compensation_remove = 0
|
| 156 |
+
|
| 157 |
+
return output, na_pos
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
# Mypy/pyright don't like the fact that the decorator is untyped
|
| 161 |
+
@register_jitable # type: ignore[misc]
|
| 162 |
+
def grouped_kahan_sum(
|
| 163 |
+
values: np.ndarray,
|
| 164 |
+
result_dtype: np.dtype,
|
| 165 |
+
labels: npt.NDArray[np.intp],
|
| 166 |
+
ngroups: int,
|
| 167 |
+
) -> tuple[
|
| 168 |
+
np.ndarray, npt.NDArray[np.int64], np.ndarray, npt.NDArray[np.int64], np.ndarray
|
| 169 |
+
]:
|
| 170 |
+
N = len(labels)
|
| 171 |
+
|
| 172 |
+
nobs_arr = np.zeros(ngroups, dtype=np.int64)
|
| 173 |
+
comp_arr = np.zeros(ngroups, dtype=values.dtype)
|
| 174 |
+
consecutive_counts = np.zeros(ngroups, dtype=np.int64)
|
| 175 |
+
prev_vals = np.zeros(ngroups, dtype=values.dtype)
|
| 176 |
+
output = np.zeros(ngroups, dtype=result_dtype)
|
| 177 |
+
|
| 178 |
+
for i in range(N):
|
| 179 |
+
lab = labels[i]
|
| 180 |
+
val = values[i]
|
| 181 |
+
|
| 182 |
+
if lab < 0:
|
| 183 |
+
continue
|
| 184 |
+
|
| 185 |
+
sum_x = output[lab]
|
| 186 |
+
nobs = nobs_arr[lab]
|
| 187 |
+
compensation_add = comp_arr[lab]
|
| 188 |
+
num_consecutive_same_value = consecutive_counts[lab]
|
| 189 |
+
prev_value = prev_vals[lab]
|
| 190 |
+
|
| 191 |
+
(
|
| 192 |
+
nobs,
|
| 193 |
+
sum_x,
|
| 194 |
+
compensation_add,
|
| 195 |
+
num_consecutive_same_value,
|
| 196 |
+
prev_value,
|
| 197 |
+
) = add_sum(
|
| 198 |
+
val,
|
| 199 |
+
nobs,
|
| 200 |
+
sum_x,
|
| 201 |
+
compensation_add,
|
| 202 |
+
num_consecutive_same_value,
|
| 203 |
+
prev_value,
|
| 204 |
+
)
|
| 205 |
+
|
| 206 |
+
output[lab] = sum_x
|
| 207 |
+
consecutive_counts[lab] = num_consecutive_same_value
|
| 208 |
+
prev_vals[lab] = prev_value
|
| 209 |
+
comp_arr[lab] = compensation_add
|
| 210 |
+
nobs_arr[lab] = nobs
|
| 211 |
+
return output, nobs_arr, comp_arr, consecutive_counts, prev_vals
|
| 212 |
+
|
| 213 |
+
|
| 214 |
+
@numba.jit(nopython=True, nogil=True, parallel=False)
|
| 215 |
+
def grouped_sum(
|
| 216 |
+
values: np.ndarray,
|
| 217 |
+
result_dtype: np.dtype,
|
| 218 |
+
labels: npt.NDArray[np.intp],
|
| 219 |
+
ngroups: int,
|
| 220 |
+
min_periods: int,
|
| 221 |
+
) -> tuple[np.ndarray, list[int]]:
|
| 222 |
+
na_pos = []
|
| 223 |
+
|
| 224 |
+
output, nobs_arr, comp_arr, consecutive_counts, prev_vals = grouped_kahan_sum(
|
| 225 |
+
values, result_dtype, labels, ngroups
|
| 226 |
+
)
|
| 227 |
+
|
| 228 |
+
# Post-processing, replace sums that don't satisfy min_periods
|
| 229 |
+
for lab in range(ngroups):
|
| 230 |
+
nobs = nobs_arr[lab]
|
| 231 |
+
num_consecutive_same_value = consecutive_counts[lab]
|
| 232 |
+
prev_value = prev_vals[lab]
|
| 233 |
+
sum_x = output[lab]
|
| 234 |
+
if nobs >= min_periods:
|
| 235 |
+
if num_consecutive_same_value >= nobs:
|
| 236 |
+
result = prev_value * nobs
|
| 237 |
+
else:
|
| 238 |
+
result = sum_x
|
| 239 |
+
else:
|
| 240 |
+
result = sum_x # Don't change val, will be replaced by nan later
|
| 241 |
+
na_pos.append(lab)
|
| 242 |
+
output[lab] = result
|
| 243 |
+
|
| 244 |
+
return output, na_pos
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__init__.py
ADDED
|
File without changes
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (172 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/align.cpython-310.pyc
ADDED
|
Binary file (6.11 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/api.cpython-310.pyc
ADDED
|
Binary file (246 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/check.cpython-310.pyc
ADDED
|
Binary file (383 Bytes). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/common.cpython-310.pyc
ADDED
|
Binary file (1.34 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/engines.cpython-310.pyc
ADDED
|
Binary file (4.37 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/eval.cpython-310.pyc
ADDED
|
Binary file (11.9 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/expr.cpython-310.pyc
ADDED
|
Binary file (22.9 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/expressions.cpython-310.pyc
ADDED
|
Binary file (6.09 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/ops.cpython-310.pyc
ADDED
|
Binary file (15.7 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/parsing.cpython-310.pyc
ADDED
|
Binary file (6.06 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/pytables.cpython-310.pyc
ADDED
|
Binary file (19.7 kB). View file
|
|
|
mgm/lib/python3.10/site-packages/pandas/core/computation/__pycache__/scope.cpython-310.pyc
ADDED
|
Binary file (8.85 kB). View file
|
|
|