Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- ckpts/llama-3b/global_step100/bf16_zero_pp_rank_154_mp_rank_00_optim_states.pt +3 -0
- ckpts/llama-3b/global_step100/bf16_zero_pp_rank_169_mp_rank_01_optim_states.pt +3 -0
- ckpts/llama-3b/global_step100/bf16_zero_pp_rank_191_mp_rank_03_optim_states.pt +3 -0
- ckpts/llama-3b/global_step100/bf16_zero_pp_rank_220_mp_rank_03_optim_states.pt +3 -0
- venv/lib/python3.10/site-packages/pandas/_libs/byteswap.pyi +5 -0
- venv/lib/python3.10/site-packages/pandas/_libs/groupby.pyi +216 -0
- venv/lib/python3.10/site-packages/pandas/_libs/hashing.cpython-310-x86_64-linux-gnu.so +0 -0
- venv/lib/python3.10/site-packages/pandas/_libs/hashing.pyi +9 -0
- venv/lib/python3.10/site-packages/pandas/_libs/index.pyi +100 -0
- venv/lib/python3.10/site-packages/pandas/_libs/indexing.cpython-310-x86_64-linux-gnu.so +0 -0
- venv/lib/python3.10/site-packages/pandas/_libs/internals.pyi +94 -0
- venv/lib/python3.10/site-packages/pandas/_libs/json.cpython-310-x86_64-linux-gnu.so +0 -0
- venv/lib/python3.10/site-packages/pandas/_libs/missing.cpython-310-x86_64-linux-gnu.so +0 -0
- venv/lib/python3.10/site-packages/pandas/_libs/sparse.pyi +51 -0
- venv/lib/python3.10/site-packages/pandas/_libs/tslib.cpython-310-x86_64-linux-gnu.so +0 -0
- venv/lib/python3.10/site-packages/pandas/_libs/tslib.pyi +37 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/__init__.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/accessor.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/algorithms.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/api.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/apply.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/arraylike.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/base.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/common.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/config_init.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/construction.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/flags.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/frame.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/generic.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/indexing.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/missing.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/nanops.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/resample.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/roperator.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/sample.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/series.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/shared_docs.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/__pycache__/sorting.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/executor.py +239 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/extensions.py +584 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/__init__.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/mean_.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/min_max_.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/shared.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/sum_.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/var_.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/computation/__init__.py +0 -0
- venv/lib/python3.10/site-packages/pandas/core/computation/__pycache__/__init__.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/computation/__pycache__/align.cpython-310.pyc +0 -0
- venv/lib/python3.10/site-packages/pandas/core/computation/__pycache__/api.cpython-310.pyc +0 -0
ckpts/llama-3b/global_step100/bf16_zero_pp_rank_154_mp_rank_00_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b875ee81b5c8375be7e5410ba10694a6d6a02a66e9f188eb085970b012668a5a
|
| 3 |
+
size 41830148
|
ckpts/llama-3b/global_step100/bf16_zero_pp_rank_169_mp_rank_01_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f8c1c8c86830ae13ac8451ec68bcea1534070ceac5b00547b696235339aa3af6
|
| 3 |
+
size 41830148
|
ckpts/llama-3b/global_step100/bf16_zero_pp_rank_191_mp_rank_03_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:bcb402ef8e202173495e1f2984b5128dcb865c560a032f40686c0af7b3adf760
|
| 3 |
+
size 41830340
|
ckpts/llama-3b/global_step100/bf16_zero_pp_rank_220_mp_rank_03_optim_states.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1ba7f4713f5a4fd90d981efcbceb2d421b2306259122738a1d3c6eb8aa19b359
|
| 3 |
+
size 41830468
|
venv/lib/python3.10/site-packages/pandas/_libs/byteswap.pyi
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
def read_float_with_byteswap(data: bytes, offset: int, byteswap: bool) -> float: ...
|
| 2 |
+
def read_double_with_byteswap(data: bytes, offset: int, byteswap: bool) -> float: ...
|
| 3 |
+
def read_uint16_with_byteswap(data: bytes, offset: int, byteswap: bool) -> int: ...
|
| 4 |
+
def read_uint32_with_byteswap(data: bytes, offset: int, byteswap: bool) -> int: ...
|
| 5 |
+
def read_uint64_with_byteswap(data: bytes, offset: int, byteswap: bool) -> int: ...
|
venv/lib/python3.10/site-packages/pandas/_libs/groupby.pyi
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Literal
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
from pandas._typing import npt
|
| 6 |
+
|
| 7 |
+
def group_median_float64(
|
| 8 |
+
out: np.ndarray, # ndarray[float64_t, ndim=2]
|
| 9 |
+
counts: npt.NDArray[np.int64],
|
| 10 |
+
values: np.ndarray, # ndarray[float64_t, ndim=2]
|
| 11 |
+
labels: npt.NDArray[np.int64],
|
| 12 |
+
min_count: int = ..., # Py_ssize_t
|
| 13 |
+
mask: np.ndarray | None = ...,
|
| 14 |
+
result_mask: np.ndarray | None = ...,
|
| 15 |
+
) -> None: ...
|
| 16 |
+
def group_cumprod(
|
| 17 |
+
out: np.ndarray, # float64_t[:, ::1]
|
| 18 |
+
values: np.ndarray, # const float64_t[:, :]
|
| 19 |
+
labels: np.ndarray, # const int64_t[:]
|
| 20 |
+
ngroups: int,
|
| 21 |
+
is_datetimelike: bool,
|
| 22 |
+
skipna: bool = ...,
|
| 23 |
+
mask: np.ndarray | None = ...,
|
| 24 |
+
result_mask: np.ndarray | None = ...,
|
| 25 |
+
) -> None: ...
|
| 26 |
+
def group_cumsum(
|
| 27 |
+
out: np.ndarray, # int64float_t[:, ::1]
|
| 28 |
+
values: np.ndarray, # ndarray[int64float_t, ndim=2]
|
| 29 |
+
labels: np.ndarray, # const int64_t[:]
|
| 30 |
+
ngroups: int,
|
| 31 |
+
is_datetimelike: bool,
|
| 32 |
+
skipna: bool = ...,
|
| 33 |
+
mask: np.ndarray | None = ...,
|
| 34 |
+
result_mask: np.ndarray | None = ...,
|
| 35 |
+
) -> None: ...
|
| 36 |
+
def group_shift_indexer(
|
| 37 |
+
out: np.ndarray, # int64_t[::1]
|
| 38 |
+
labels: np.ndarray, # const int64_t[:]
|
| 39 |
+
ngroups: int,
|
| 40 |
+
periods: int,
|
| 41 |
+
) -> None: ...
|
| 42 |
+
def group_fillna_indexer(
|
| 43 |
+
out: np.ndarray, # ndarray[intp_t]
|
| 44 |
+
labels: np.ndarray, # ndarray[int64_t]
|
| 45 |
+
sorted_labels: npt.NDArray[np.intp],
|
| 46 |
+
mask: npt.NDArray[np.uint8],
|
| 47 |
+
limit: int, # int64_t
|
| 48 |
+
dropna: bool,
|
| 49 |
+
) -> None: ...
|
| 50 |
+
def group_any_all(
|
| 51 |
+
out: np.ndarray, # uint8_t[::1]
|
| 52 |
+
values: np.ndarray, # const uint8_t[::1]
|
| 53 |
+
labels: np.ndarray, # const int64_t[:]
|
| 54 |
+
mask: np.ndarray, # const uint8_t[::1]
|
| 55 |
+
val_test: Literal["any", "all"],
|
| 56 |
+
skipna: bool,
|
| 57 |
+
result_mask: np.ndarray | None,
|
| 58 |
+
) -> None: ...
|
| 59 |
+
def group_sum(
|
| 60 |
+
out: np.ndarray, # complexfloatingintuint_t[:, ::1]
|
| 61 |
+
counts: np.ndarray, # int64_t[::1]
|
| 62 |
+
values: np.ndarray, # ndarray[complexfloatingintuint_t, ndim=2]
|
| 63 |
+
labels: np.ndarray, # const intp_t[:]
|
| 64 |
+
mask: np.ndarray | None,
|
| 65 |
+
result_mask: np.ndarray | None = ...,
|
| 66 |
+
min_count: int = ...,
|
| 67 |
+
is_datetimelike: bool = ...,
|
| 68 |
+
) -> None: ...
|
| 69 |
+
def group_prod(
|
| 70 |
+
out: np.ndarray, # int64float_t[:, ::1]
|
| 71 |
+
counts: np.ndarray, # int64_t[::1]
|
| 72 |
+
values: np.ndarray, # ndarray[int64float_t, ndim=2]
|
| 73 |
+
labels: np.ndarray, # const intp_t[:]
|
| 74 |
+
mask: np.ndarray | None,
|
| 75 |
+
result_mask: np.ndarray | None = ...,
|
| 76 |
+
min_count: int = ...,
|
| 77 |
+
) -> None: ...
|
| 78 |
+
def group_var(
|
| 79 |
+
out: np.ndarray, # floating[:, ::1]
|
| 80 |
+
counts: np.ndarray, # int64_t[::1]
|
| 81 |
+
values: np.ndarray, # ndarray[floating, ndim=2]
|
| 82 |
+
labels: np.ndarray, # const intp_t[:]
|
| 83 |
+
min_count: int = ..., # Py_ssize_t
|
| 84 |
+
ddof: int = ..., # int64_t
|
| 85 |
+
mask: np.ndarray | None = ...,
|
| 86 |
+
result_mask: np.ndarray | None = ...,
|
| 87 |
+
is_datetimelike: bool = ...,
|
| 88 |
+
name: str = ...,
|
| 89 |
+
) -> None: ...
|
| 90 |
+
def group_skew(
|
| 91 |
+
out: np.ndarray, # float64_t[:, ::1]
|
| 92 |
+
counts: np.ndarray, # int64_t[::1]
|
| 93 |
+
values: np.ndarray, # ndarray[float64_T, ndim=2]
|
| 94 |
+
labels: np.ndarray, # const intp_t[::1]
|
| 95 |
+
mask: np.ndarray | None = ...,
|
| 96 |
+
result_mask: np.ndarray | None = ...,
|
| 97 |
+
skipna: bool = ...,
|
| 98 |
+
) -> None: ...
|
| 99 |
+
def group_mean(
|
| 100 |
+
out: np.ndarray, # floating[:, ::1]
|
| 101 |
+
counts: np.ndarray, # int64_t[::1]
|
| 102 |
+
values: np.ndarray, # ndarray[floating, ndim=2]
|
| 103 |
+
labels: np.ndarray, # const intp_t[:]
|
| 104 |
+
min_count: int = ..., # Py_ssize_t
|
| 105 |
+
is_datetimelike: bool = ..., # bint
|
| 106 |
+
mask: np.ndarray | None = ...,
|
| 107 |
+
result_mask: np.ndarray | None = ...,
|
| 108 |
+
) -> None: ...
|
| 109 |
+
def group_ohlc(
|
| 110 |
+
out: np.ndarray, # floatingintuint_t[:, ::1]
|
| 111 |
+
counts: np.ndarray, # int64_t[::1]
|
| 112 |
+
values: np.ndarray, # ndarray[floatingintuint_t, ndim=2]
|
| 113 |
+
labels: np.ndarray, # const intp_t[:]
|
| 114 |
+
min_count: int = ...,
|
| 115 |
+
mask: np.ndarray | None = ...,
|
| 116 |
+
result_mask: np.ndarray | None = ...,
|
| 117 |
+
) -> None: ...
|
| 118 |
+
def group_quantile(
|
| 119 |
+
out: npt.NDArray[np.float64],
|
| 120 |
+
values: np.ndarray, # ndarray[numeric, ndim=1]
|
| 121 |
+
labels: npt.NDArray[np.intp],
|
| 122 |
+
mask: npt.NDArray[np.uint8],
|
| 123 |
+
qs: npt.NDArray[np.float64], # const
|
| 124 |
+
starts: npt.NDArray[np.int64],
|
| 125 |
+
ends: npt.NDArray[np.int64],
|
| 126 |
+
interpolation: Literal["linear", "lower", "higher", "nearest", "midpoint"],
|
| 127 |
+
result_mask: np.ndarray | None,
|
| 128 |
+
is_datetimelike: bool,
|
| 129 |
+
) -> None: ...
|
| 130 |
+
def group_last(
|
| 131 |
+
out: np.ndarray, # rank_t[:, ::1]
|
| 132 |
+
counts: np.ndarray, # int64_t[::1]
|
| 133 |
+
values: np.ndarray, # ndarray[rank_t, ndim=2]
|
| 134 |
+
labels: np.ndarray, # const int64_t[:]
|
| 135 |
+
mask: npt.NDArray[np.bool_] | None,
|
| 136 |
+
result_mask: npt.NDArray[np.bool_] | None = ...,
|
| 137 |
+
min_count: int = ..., # Py_ssize_t
|
| 138 |
+
is_datetimelike: bool = ...,
|
| 139 |
+
skipna: bool = ...,
|
| 140 |
+
) -> None: ...
|
| 141 |
+
def group_nth(
|
| 142 |
+
out: np.ndarray, # rank_t[:, ::1]
|
| 143 |
+
counts: np.ndarray, # int64_t[::1]
|
| 144 |
+
values: np.ndarray, # ndarray[rank_t, ndim=2]
|
| 145 |
+
labels: np.ndarray, # const int64_t[:]
|
| 146 |
+
mask: npt.NDArray[np.bool_] | None,
|
| 147 |
+
result_mask: npt.NDArray[np.bool_] | None = ...,
|
| 148 |
+
min_count: int = ..., # int64_t
|
| 149 |
+
rank: int = ..., # int64_t
|
| 150 |
+
is_datetimelike: bool = ...,
|
| 151 |
+
skipna: bool = ...,
|
| 152 |
+
) -> None: ...
|
| 153 |
+
def group_rank(
|
| 154 |
+
out: np.ndarray, # float64_t[:, ::1]
|
| 155 |
+
values: np.ndarray, # ndarray[rank_t, ndim=2]
|
| 156 |
+
labels: np.ndarray, # const int64_t[:]
|
| 157 |
+
ngroups: int,
|
| 158 |
+
is_datetimelike: bool,
|
| 159 |
+
ties_method: Literal["average", "min", "max", "first", "dense"] = ...,
|
| 160 |
+
ascending: bool = ...,
|
| 161 |
+
pct: bool = ...,
|
| 162 |
+
na_option: Literal["keep", "top", "bottom"] = ...,
|
| 163 |
+
mask: npt.NDArray[np.bool_] | None = ...,
|
| 164 |
+
) -> None: ...
|
| 165 |
+
def group_max(
|
| 166 |
+
out: np.ndarray, # groupby_t[:, ::1]
|
| 167 |
+
counts: np.ndarray, # int64_t[::1]
|
| 168 |
+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
|
| 169 |
+
labels: np.ndarray, # const int64_t[:]
|
| 170 |
+
min_count: int = ...,
|
| 171 |
+
is_datetimelike: bool = ...,
|
| 172 |
+
mask: np.ndarray | None = ...,
|
| 173 |
+
result_mask: np.ndarray | None = ...,
|
| 174 |
+
) -> None: ...
|
| 175 |
+
def group_min(
|
| 176 |
+
out: np.ndarray, # groupby_t[:, ::1]
|
| 177 |
+
counts: np.ndarray, # int64_t[::1]
|
| 178 |
+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
|
| 179 |
+
labels: np.ndarray, # const int64_t[:]
|
| 180 |
+
min_count: int = ...,
|
| 181 |
+
is_datetimelike: bool = ...,
|
| 182 |
+
mask: np.ndarray | None = ...,
|
| 183 |
+
result_mask: np.ndarray | None = ...,
|
| 184 |
+
) -> None: ...
|
| 185 |
+
def group_idxmin_idxmax(
|
| 186 |
+
out: npt.NDArray[np.intp],
|
| 187 |
+
counts: npt.NDArray[np.int64],
|
| 188 |
+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
|
| 189 |
+
labels: npt.NDArray[np.intp],
|
| 190 |
+
min_count: int = ...,
|
| 191 |
+
is_datetimelike: bool = ...,
|
| 192 |
+
mask: np.ndarray | None = ...,
|
| 193 |
+
name: str = ...,
|
| 194 |
+
skipna: bool = ...,
|
| 195 |
+
result_mask: np.ndarray | None = ...,
|
| 196 |
+
) -> None: ...
|
| 197 |
+
def group_cummin(
|
| 198 |
+
out: np.ndarray, # groupby_t[:, ::1]
|
| 199 |
+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
|
| 200 |
+
labels: np.ndarray, # const int64_t[:]
|
| 201 |
+
ngroups: int,
|
| 202 |
+
is_datetimelike: bool,
|
| 203 |
+
mask: np.ndarray | None = ...,
|
| 204 |
+
result_mask: np.ndarray | None = ...,
|
| 205 |
+
skipna: bool = ...,
|
| 206 |
+
) -> None: ...
|
| 207 |
+
def group_cummax(
|
| 208 |
+
out: np.ndarray, # groupby_t[:, ::1]
|
| 209 |
+
values: np.ndarray, # ndarray[groupby_t, ndim=2]
|
| 210 |
+
labels: np.ndarray, # const int64_t[:]
|
| 211 |
+
ngroups: int,
|
| 212 |
+
is_datetimelike: bool,
|
| 213 |
+
mask: np.ndarray | None = ...,
|
| 214 |
+
result_mask: np.ndarray | None = ...,
|
| 215 |
+
skipna: bool = ...,
|
| 216 |
+
) -> None: ...
|
venv/lib/python3.10/site-packages/pandas/_libs/hashing.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (221 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/_libs/hashing.pyi
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
|
| 3 |
+
from pandas._typing import npt
|
| 4 |
+
|
| 5 |
+
def hash_object_array(
|
| 6 |
+
arr: npt.NDArray[np.object_],
|
| 7 |
+
key: str,
|
| 8 |
+
encoding: str = ...,
|
| 9 |
+
) -> npt.NDArray[np.uint64]: ...
|
venv/lib/python3.10/site-packages/pandas/_libs/index.pyi
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
|
| 3 |
+
from pandas._typing import npt
|
| 4 |
+
|
| 5 |
+
from pandas import MultiIndex
|
| 6 |
+
from pandas.core.arrays import ExtensionArray
|
| 7 |
+
|
| 8 |
+
multiindex_nulls_shift: int
|
| 9 |
+
|
| 10 |
+
class IndexEngine:
|
| 11 |
+
over_size_threshold: bool
|
| 12 |
+
def __init__(self, values: np.ndarray) -> None: ...
|
| 13 |
+
def __contains__(self, val: object) -> bool: ...
|
| 14 |
+
|
| 15 |
+
# -> int | slice | np.ndarray[bool]
|
| 16 |
+
def get_loc(self, val: object) -> int | slice | np.ndarray: ...
|
| 17 |
+
def sizeof(self, deep: bool = ...) -> int: ...
|
| 18 |
+
def __sizeof__(self) -> int: ...
|
| 19 |
+
@property
|
| 20 |
+
def is_unique(self) -> bool: ...
|
| 21 |
+
@property
|
| 22 |
+
def is_monotonic_increasing(self) -> bool: ...
|
| 23 |
+
@property
|
| 24 |
+
def is_monotonic_decreasing(self) -> bool: ...
|
| 25 |
+
@property
|
| 26 |
+
def is_mapping_populated(self) -> bool: ...
|
| 27 |
+
def clear_mapping(self): ...
|
| 28 |
+
def get_indexer(self, values: np.ndarray) -> npt.NDArray[np.intp]: ...
|
| 29 |
+
def get_indexer_non_unique(
|
| 30 |
+
self,
|
| 31 |
+
targets: np.ndarray,
|
| 32 |
+
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
|
| 33 |
+
|
| 34 |
+
class MaskedIndexEngine(IndexEngine):
|
| 35 |
+
def __init__(self, values: object) -> None: ...
|
| 36 |
+
def get_indexer_non_unique(
|
| 37 |
+
self, targets: object
|
| 38 |
+
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
|
| 39 |
+
|
| 40 |
+
class Float64Engine(IndexEngine): ...
|
| 41 |
+
class Float32Engine(IndexEngine): ...
|
| 42 |
+
class Complex128Engine(IndexEngine): ...
|
| 43 |
+
class Complex64Engine(IndexEngine): ...
|
| 44 |
+
class Int64Engine(IndexEngine): ...
|
| 45 |
+
class Int32Engine(IndexEngine): ...
|
| 46 |
+
class Int16Engine(IndexEngine): ...
|
| 47 |
+
class Int8Engine(IndexEngine): ...
|
| 48 |
+
class UInt64Engine(IndexEngine): ...
|
| 49 |
+
class UInt32Engine(IndexEngine): ...
|
| 50 |
+
class UInt16Engine(IndexEngine): ...
|
| 51 |
+
class UInt8Engine(IndexEngine): ...
|
| 52 |
+
class ObjectEngine(IndexEngine): ...
|
| 53 |
+
class DatetimeEngine(Int64Engine): ...
|
| 54 |
+
class TimedeltaEngine(DatetimeEngine): ...
|
| 55 |
+
class PeriodEngine(Int64Engine): ...
|
| 56 |
+
class BoolEngine(UInt8Engine): ...
|
| 57 |
+
class MaskedFloat64Engine(MaskedIndexEngine): ...
|
| 58 |
+
class MaskedFloat32Engine(MaskedIndexEngine): ...
|
| 59 |
+
class MaskedComplex128Engine(MaskedIndexEngine): ...
|
| 60 |
+
class MaskedComplex64Engine(MaskedIndexEngine): ...
|
| 61 |
+
class MaskedInt64Engine(MaskedIndexEngine): ...
|
| 62 |
+
class MaskedInt32Engine(MaskedIndexEngine): ...
|
| 63 |
+
class MaskedInt16Engine(MaskedIndexEngine): ...
|
| 64 |
+
class MaskedInt8Engine(MaskedIndexEngine): ...
|
| 65 |
+
class MaskedUInt64Engine(MaskedIndexEngine): ...
|
| 66 |
+
class MaskedUInt32Engine(MaskedIndexEngine): ...
|
| 67 |
+
class MaskedUInt16Engine(MaskedIndexEngine): ...
|
| 68 |
+
class MaskedUInt8Engine(MaskedIndexEngine): ...
|
| 69 |
+
class MaskedBoolEngine(MaskedUInt8Engine): ...
|
| 70 |
+
|
| 71 |
+
class BaseMultiIndexCodesEngine:
|
| 72 |
+
levels: list[np.ndarray]
|
| 73 |
+
offsets: np.ndarray # ndarray[uint64_t, ndim=1]
|
| 74 |
+
|
| 75 |
+
def __init__(
|
| 76 |
+
self,
|
| 77 |
+
levels: list[np.ndarray], # all entries hashable
|
| 78 |
+
labels: list[np.ndarray], # all entries integer-dtyped
|
| 79 |
+
offsets: np.ndarray, # np.ndarray[np.uint64, ndim=1]
|
| 80 |
+
) -> None: ...
|
| 81 |
+
def get_indexer(self, target: npt.NDArray[np.object_]) -> npt.NDArray[np.intp]: ...
|
| 82 |
+
def _extract_level_codes(self, target: MultiIndex) -> np.ndarray: ...
|
| 83 |
+
|
| 84 |
+
class ExtensionEngine:
|
| 85 |
+
def __init__(self, values: ExtensionArray) -> None: ...
|
| 86 |
+
def __contains__(self, val: object) -> bool: ...
|
| 87 |
+
def get_loc(self, val: object) -> int | slice | np.ndarray: ...
|
| 88 |
+
def get_indexer(self, values: np.ndarray) -> npt.NDArray[np.intp]: ...
|
| 89 |
+
def get_indexer_non_unique(
|
| 90 |
+
self,
|
| 91 |
+
targets: np.ndarray,
|
| 92 |
+
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
|
| 93 |
+
@property
|
| 94 |
+
def is_unique(self) -> bool: ...
|
| 95 |
+
@property
|
| 96 |
+
def is_monotonic_increasing(self) -> bool: ...
|
| 97 |
+
@property
|
| 98 |
+
def is_monotonic_decreasing(self) -> bool: ...
|
| 99 |
+
def sizeof(self, deep: bool = ...) -> int: ...
|
| 100 |
+
def clear_mapping(self): ...
|
venv/lib/python3.10/site-packages/pandas/_libs/indexing.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (66.6 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/_libs/internals.pyi
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import (
|
| 2 |
+
Iterator,
|
| 3 |
+
Sequence,
|
| 4 |
+
final,
|
| 5 |
+
overload,
|
| 6 |
+
)
|
| 7 |
+
import weakref
|
| 8 |
+
|
| 9 |
+
import numpy as np
|
| 10 |
+
|
| 11 |
+
from pandas._typing import (
|
| 12 |
+
ArrayLike,
|
| 13 |
+
Self,
|
| 14 |
+
npt,
|
| 15 |
+
)
|
| 16 |
+
|
| 17 |
+
from pandas import Index
|
| 18 |
+
from pandas.core.internals.blocks import Block as B
|
| 19 |
+
|
| 20 |
+
def slice_len(slc: slice, objlen: int = ...) -> int: ...
|
| 21 |
+
def get_concat_blkno_indexers(
|
| 22 |
+
blknos_list: list[npt.NDArray[np.intp]],
|
| 23 |
+
) -> list[tuple[npt.NDArray[np.intp], BlockPlacement]]: ...
|
| 24 |
+
def get_blkno_indexers(
|
| 25 |
+
blknos: np.ndarray, # int64_t[:]
|
| 26 |
+
group: bool = ...,
|
| 27 |
+
) -> list[tuple[int, slice | np.ndarray]]: ...
|
| 28 |
+
def get_blkno_placements(
|
| 29 |
+
blknos: np.ndarray,
|
| 30 |
+
group: bool = ...,
|
| 31 |
+
) -> Iterator[tuple[int, BlockPlacement]]: ...
|
| 32 |
+
def update_blklocs_and_blknos(
|
| 33 |
+
blklocs: npt.NDArray[np.intp],
|
| 34 |
+
blknos: npt.NDArray[np.intp],
|
| 35 |
+
loc: int,
|
| 36 |
+
nblocks: int,
|
| 37 |
+
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
|
| 38 |
+
@final
|
| 39 |
+
class BlockPlacement:
|
| 40 |
+
def __init__(self, val: int | slice | np.ndarray) -> None: ...
|
| 41 |
+
@property
|
| 42 |
+
def indexer(self) -> np.ndarray | slice: ...
|
| 43 |
+
@property
|
| 44 |
+
def as_array(self) -> np.ndarray: ...
|
| 45 |
+
@property
|
| 46 |
+
def as_slice(self) -> slice: ...
|
| 47 |
+
@property
|
| 48 |
+
def is_slice_like(self) -> bool: ...
|
| 49 |
+
@overload
|
| 50 |
+
def __getitem__(
|
| 51 |
+
self, loc: slice | Sequence[int] | npt.NDArray[np.intp]
|
| 52 |
+
) -> BlockPlacement: ...
|
| 53 |
+
@overload
|
| 54 |
+
def __getitem__(self, loc: int) -> int: ...
|
| 55 |
+
def __iter__(self) -> Iterator[int]: ...
|
| 56 |
+
def __len__(self) -> int: ...
|
| 57 |
+
def delete(self, loc) -> BlockPlacement: ...
|
| 58 |
+
def add(self, other) -> BlockPlacement: ...
|
| 59 |
+
def append(self, others: list[BlockPlacement]) -> BlockPlacement: ...
|
| 60 |
+
def tile_for_unstack(self, factor: int) -> npt.NDArray[np.intp]: ...
|
| 61 |
+
|
| 62 |
+
class Block:
|
| 63 |
+
_mgr_locs: BlockPlacement
|
| 64 |
+
ndim: int
|
| 65 |
+
values: ArrayLike
|
| 66 |
+
refs: BlockValuesRefs
|
| 67 |
+
def __init__(
|
| 68 |
+
self,
|
| 69 |
+
values: ArrayLike,
|
| 70 |
+
placement: BlockPlacement,
|
| 71 |
+
ndim: int,
|
| 72 |
+
refs: BlockValuesRefs | None = ...,
|
| 73 |
+
) -> None: ...
|
| 74 |
+
def slice_block_rows(self, slicer: slice) -> Self: ...
|
| 75 |
+
|
| 76 |
+
class BlockManager:
|
| 77 |
+
blocks: tuple[B, ...]
|
| 78 |
+
axes: list[Index]
|
| 79 |
+
_known_consolidated: bool
|
| 80 |
+
_is_consolidated: bool
|
| 81 |
+
_blknos: np.ndarray
|
| 82 |
+
_blklocs: np.ndarray
|
| 83 |
+
def __init__(
|
| 84 |
+
self, blocks: tuple[B, ...], axes: list[Index], verify_integrity=...
|
| 85 |
+
) -> None: ...
|
| 86 |
+
def get_slice(self, slobj: slice, axis: int = ...) -> Self: ...
|
| 87 |
+
def _rebuild_blknos_and_blklocs(self) -> None: ...
|
| 88 |
+
|
| 89 |
+
class BlockValuesRefs:
|
| 90 |
+
referenced_blocks: list[weakref.ref]
|
| 91 |
+
def __init__(self, blk: Block | None = ...) -> None: ...
|
| 92 |
+
def add_reference(self, blk: Block) -> None: ...
|
| 93 |
+
def add_index_reference(self, index: Index) -> None: ...
|
| 94 |
+
def has_reference(self) -> bool: ...
|
venv/lib/python3.10/site-packages/pandas/_libs/json.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (64.3 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/_libs/missing.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (211 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/_libs/sparse.pyi
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Sequence
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
from pandas._typing import (
|
| 6 |
+
Self,
|
| 7 |
+
npt,
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
class SparseIndex:
|
| 11 |
+
length: int
|
| 12 |
+
npoints: int
|
| 13 |
+
def __init__(self) -> None: ...
|
| 14 |
+
@property
|
| 15 |
+
def ngaps(self) -> int: ...
|
| 16 |
+
@property
|
| 17 |
+
def nbytes(self) -> int: ...
|
| 18 |
+
@property
|
| 19 |
+
def indices(self) -> npt.NDArray[np.int32]: ...
|
| 20 |
+
def equals(self, other) -> bool: ...
|
| 21 |
+
def lookup(self, index: int) -> np.int32: ...
|
| 22 |
+
def lookup_array(self, indexer: npt.NDArray[np.int32]) -> npt.NDArray[np.int32]: ...
|
| 23 |
+
def to_int_index(self) -> IntIndex: ...
|
| 24 |
+
def to_block_index(self) -> BlockIndex: ...
|
| 25 |
+
def intersect(self, y_: SparseIndex) -> Self: ...
|
| 26 |
+
def make_union(self, y_: SparseIndex) -> Self: ...
|
| 27 |
+
|
| 28 |
+
class IntIndex(SparseIndex):
|
| 29 |
+
indices: npt.NDArray[np.int32]
|
| 30 |
+
def __init__(
|
| 31 |
+
self, length: int, indices: Sequence[int], check_integrity: bool = ...
|
| 32 |
+
) -> None: ...
|
| 33 |
+
|
| 34 |
+
class BlockIndex(SparseIndex):
|
| 35 |
+
nblocks: int
|
| 36 |
+
blocs: np.ndarray
|
| 37 |
+
blengths: np.ndarray
|
| 38 |
+
def __init__(
|
| 39 |
+
self, length: int, blocs: np.ndarray, blengths: np.ndarray
|
| 40 |
+
) -> None: ...
|
| 41 |
+
|
| 42 |
+
# Override to have correct parameters
|
| 43 |
+
def intersect(self, other: SparseIndex) -> Self: ...
|
| 44 |
+
def make_union(self, y: SparseIndex) -> Self: ...
|
| 45 |
+
|
| 46 |
+
def make_mask_object_ndarray(
|
| 47 |
+
arr: npt.NDArray[np.object_], fill_value
|
| 48 |
+
) -> npt.NDArray[np.bool_]: ...
|
| 49 |
+
def get_blocks(
|
| 50 |
+
indices: npt.NDArray[np.int32],
|
| 51 |
+
) -> tuple[npt.NDArray[np.int32], npt.NDArray[np.int32]]: ...
|
venv/lib/python3.10/site-packages/pandas/_libs/tslib.cpython-310-x86_64-linux-gnu.so
ADDED
|
Binary file (340 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/_libs/tslib.pyi
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from datetime import tzinfo
|
| 2 |
+
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
from pandas._typing import npt
|
| 6 |
+
|
| 7 |
+
def format_array_from_datetime(
|
| 8 |
+
values: npt.NDArray[np.int64],
|
| 9 |
+
tz: tzinfo | None = ...,
|
| 10 |
+
format: str | None = ...,
|
| 11 |
+
na_rep: str | float = ...,
|
| 12 |
+
reso: int = ..., # NPY_DATETIMEUNIT
|
| 13 |
+
) -> npt.NDArray[np.object_]: ...
|
| 14 |
+
def array_with_unit_to_datetime(
|
| 15 |
+
values: npt.NDArray[np.object_],
|
| 16 |
+
unit: str,
|
| 17 |
+
errors: str = ...,
|
| 18 |
+
) -> tuple[np.ndarray, tzinfo | None]: ...
|
| 19 |
+
def first_non_null(values: np.ndarray) -> int: ...
|
| 20 |
+
def array_to_datetime(
|
| 21 |
+
values: npt.NDArray[np.object_],
|
| 22 |
+
errors: str = ...,
|
| 23 |
+
dayfirst: bool = ...,
|
| 24 |
+
yearfirst: bool = ...,
|
| 25 |
+
utc: bool = ...,
|
| 26 |
+
creso: int = ...,
|
| 27 |
+
) -> tuple[np.ndarray, tzinfo | None]: ...
|
| 28 |
+
|
| 29 |
+
# returned ndarray may be object dtype or datetime64[ns]
|
| 30 |
+
|
| 31 |
+
def array_to_datetime_with_tz(
|
| 32 |
+
values: npt.NDArray[np.object_],
|
| 33 |
+
tz: tzinfo,
|
| 34 |
+
dayfirst: bool,
|
| 35 |
+
yearfirst: bool,
|
| 36 |
+
creso: int,
|
| 37 |
+
) -> npt.NDArray[np.int64]: ...
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (179 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/accessor.cpython-310.pyc
ADDED
|
Binary file (11.2 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/algorithms.cpython-310.pyc
ADDED
|
Binary file (39.6 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/api.cpython-310.pyc
ADDED
|
Binary file (2.62 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/apply.cpython-310.pyc
ADDED
|
Binary file (49.8 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/arraylike.cpython-310.pyc
ADDED
|
Binary file (14.4 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/base.cpython-310.pyc
ADDED
|
Binary file (37.8 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/common.cpython-310.pyc
ADDED
|
Binary file (17.1 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/config_init.cpython-310.pyc
ADDED
|
Binary file (20.7 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/construction.cpython-310.pyc
ADDED
|
Binary file (19.7 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/flags.cpython-310.pyc
ADDED
|
Binary file (4.34 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/frame.cpython-310.pyc
ADDED
|
Binary file (363 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/generic.cpython-310.pyc
ADDED
|
Binary file (386 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/indexing.cpython-310.pyc
ADDED
|
Binary file (68.7 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/missing.cpython-310.pyc
ADDED
|
Binary file (26.6 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/nanops.cpython-310.pyc
ADDED
|
Binary file (37 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/resample.cpython-310.pyc
ADDED
|
Binary file (74.8 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/roperator.cpython-310.pyc
ADDED
|
Binary file (1.81 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/sample.cpython-310.pyc
ADDED
|
Binary file (3.96 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/series.cpython-310.pyc
ADDED
|
Binary file (176 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/shared_docs.cpython-310.pyc
ADDED
|
Binary file (30.2 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/__pycache__/sorting.cpython-310.pyc
ADDED
|
Binary file (19.9 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/_numba/executor.py
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
+
import functools
|
| 4 |
+
from typing import (
|
| 5 |
+
TYPE_CHECKING,
|
| 6 |
+
Any,
|
| 7 |
+
Callable,
|
| 8 |
+
)
|
| 9 |
+
|
| 10 |
+
if TYPE_CHECKING:
|
| 11 |
+
from pandas._typing import Scalar
|
| 12 |
+
|
| 13 |
+
import numpy as np
|
| 14 |
+
|
| 15 |
+
from pandas.compat._optional import import_optional_dependency
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
@functools.cache
|
| 19 |
+
def generate_apply_looper(func, nopython=True, nogil=True, parallel=False):
|
| 20 |
+
if TYPE_CHECKING:
|
| 21 |
+
import numba
|
| 22 |
+
else:
|
| 23 |
+
numba = import_optional_dependency("numba")
|
| 24 |
+
nb_compat_func = numba.extending.register_jitable(func)
|
| 25 |
+
|
| 26 |
+
@numba.jit(nopython=nopython, nogil=nogil, parallel=parallel)
|
| 27 |
+
def nb_looper(values, axis):
|
| 28 |
+
# Operate on the first row/col in order to get
|
| 29 |
+
# the output shape
|
| 30 |
+
if axis == 0:
|
| 31 |
+
first_elem = values[:, 0]
|
| 32 |
+
dim0 = values.shape[1]
|
| 33 |
+
else:
|
| 34 |
+
first_elem = values[0]
|
| 35 |
+
dim0 = values.shape[0]
|
| 36 |
+
res0 = nb_compat_func(first_elem)
|
| 37 |
+
# Use np.asarray to get shape for
|
| 38 |
+
# https://github.com/numba/numba/issues/4202#issuecomment-1185981507
|
| 39 |
+
buf_shape = (dim0,) + np.atleast_1d(np.asarray(res0)).shape
|
| 40 |
+
if axis == 0:
|
| 41 |
+
buf_shape = buf_shape[::-1]
|
| 42 |
+
buff = np.empty(buf_shape)
|
| 43 |
+
|
| 44 |
+
if axis == 1:
|
| 45 |
+
buff[0] = res0
|
| 46 |
+
for i in numba.prange(1, values.shape[0]):
|
| 47 |
+
buff[i] = nb_compat_func(values[i])
|
| 48 |
+
else:
|
| 49 |
+
buff[:, 0] = res0
|
| 50 |
+
for j in numba.prange(1, values.shape[1]):
|
| 51 |
+
buff[:, j] = nb_compat_func(values[:, j])
|
| 52 |
+
return buff
|
| 53 |
+
|
| 54 |
+
return nb_looper
|
| 55 |
+
|
| 56 |
+
|
| 57 |
+
@functools.cache
|
| 58 |
+
def make_looper(func, result_dtype, is_grouped_kernel, nopython, nogil, parallel):
|
| 59 |
+
if TYPE_CHECKING:
|
| 60 |
+
import numba
|
| 61 |
+
else:
|
| 62 |
+
numba = import_optional_dependency("numba")
|
| 63 |
+
|
| 64 |
+
if is_grouped_kernel:
|
| 65 |
+
|
| 66 |
+
@numba.jit(nopython=nopython, nogil=nogil, parallel=parallel)
|
| 67 |
+
def column_looper(
|
| 68 |
+
values: np.ndarray,
|
| 69 |
+
labels: np.ndarray,
|
| 70 |
+
ngroups: int,
|
| 71 |
+
min_periods: int,
|
| 72 |
+
*args,
|
| 73 |
+
):
|
| 74 |
+
result = np.empty((values.shape[0], ngroups), dtype=result_dtype)
|
| 75 |
+
na_positions = {}
|
| 76 |
+
for i in numba.prange(values.shape[0]):
|
| 77 |
+
output, na_pos = func(
|
| 78 |
+
values[i], result_dtype, labels, ngroups, min_periods, *args
|
| 79 |
+
)
|
| 80 |
+
result[i] = output
|
| 81 |
+
if len(na_pos) > 0:
|
| 82 |
+
na_positions[i] = np.array(na_pos)
|
| 83 |
+
return result, na_positions
|
| 84 |
+
|
| 85 |
+
else:
|
| 86 |
+
|
| 87 |
+
@numba.jit(nopython=nopython, nogil=nogil, parallel=parallel)
|
| 88 |
+
def column_looper(
|
| 89 |
+
values: np.ndarray,
|
| 90 |
+
start: np.ndarray,
|
| 91 |
+
end: np.ndarray,
|
| 92 |
+
min_periods: int,
|
| 93 |
+
*args,
|
| 94 |
+
):
|
| 95 |
+
result = np.empty((values.shape[0], len(start)), dtype=result_dtype)
|
| 96 |
+
na_positions = {}
|
| 97 |
+
for i in numba.prange(values.shape[0]):
|
| 98 |
+
output, na_pos = func(
|
| 99 |
+
values[i], result_dtype, start, end, min_periods, *args
|
| 100 |
+
)
|
| 101 |
+
result[i] = output
|
| 102 |
+
if len(na_pos) > 0:
|
| 103 |
+
na_positions[i] = np.array(na_pos)
|
| 104 |
+
return result, na_positions
|
| 105 |
+
|
| 106 |
+
return column_looper
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
default_dtype_mapping: dict[np.dtype, Any] = {
|
| 110 |
+
np.dtype("int8"): np.int64,
|
| 111 |
+
np.dtype("int16"): np.int64,
|
| 112 |
+
np.dtype("int32"): np.int64,
|
| 113 |
+
np.dtype("int64"): np.int64,
|
| 114 |
+
np.dtype("uint8"): np.uint64,
|
| 115 |
+
np.dtype("uint16"): np.uint64,
|
| 116 |
+
np.dtype("uint32"): np.uint64,
|
| 117 |
+
np.dtype("uint64"): np.uint64,
|
| 118 |
+
np.dtype("float32"): np.float64,
|
| 119 |
+
np.dtype("float64"): np.float64,
|
| 120 |
+
np.dtype("complex64"): np.complex128,
|
| 121 |
+
np.dtype("complex128"): np.complex128,
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
# TODO: Preserve complex dtypes
|
| 126 |
+
|
| 127 |
+
float_dtype_mapping: dict[np.dtype, Any] = {
|
| 128 |
+
np.dtype("int8"): np.float64,
|
| 129 |
+
np.dtype("int16"): np.float64,
|
| 130 |
+
np.dtype("int32"): np.float64,
|
| 131 |
+
np.dtype("int64"): np.float64,
|
| 132 |
+
np.dtype("uint8"): np.float64,
|
| 133 |
+
np.dtype("uint16"): np.float64,
|
| 134 |
+
np.dtype("uint32"): np.float64,
|
| 135 |
+
np.dtype("uint64"): np.float64,
|
| 136 |
+
np.dtype("float32"): np.float64,
|
| 137 |
+
np.dtype("float64"): np.float64,
|
| 138 |
+
np.dtype("complex64"): np.float64,
|
| 139 |
+
np.dtype("complex128"): np.float64,
|
| 140 |
+
}
|
| 141 |
+
|
| 142 |
+
identity_dtype_mapping: dict[np.dtype, Any] = {
|
| 143 |
+
np.dtype("int8"): np.int8,
|
| 144 |
+
np.dtype("int16"): np.int16,
|
| 145 |
+
np.dtype("int32"): np.int32,
|
| 146 |
+
np.dtype("int64"): np.int64,
|
| 147 |
+
np.dtype("uint8"): np.uint8,
|
| 148 |
+
np.dtype("uint16"): np.uint16,
|
| 149 |
+
np.dtype("uint32"): np.uint32,
|
| 150 |
+
np.dtype("uint64"): np.uint64,
|
| 151 |
+
np.dtype("float32"): np.float32,
|
| 152 |
+
np.dtype("float64"): np.float64,
|
| 153 |
+
np.dtype("complex64"): np.complex64,
|
| 154 |
+
np.dtype("complex128"): np.complex128,
|
| 155 |
+
}
|
| 156 |
+
|
| 157 |
+
|
| 158 |
+
def generate_shared_aggregator(
|
| 159 |
+
func: Callable[..., Scalar],
|
| 160 |
+
dtype_mapping: dict[np.dtype, np.dtype],
|
| 161 |
+
is_grouped_kernel: bool,
|
| 162 |
+
nopython: bool,
|
| 163 |
+
nogil: bool,
|
| 164 |
+
parallel: bool,
|
| 165 |
+
):
|
| 166 |
+
"""
|
| 167 |
+
Generate a Numba function that loops over the columns 2D object and applies
|
| 168 |
+
a 1D numba kernel over each column.
|
| 169 |
+
|
| 170 |
+
Parameters
|
| 171 |
+
----------
|
| 172 |
+
func : function
|
| 173 |
+
aggregation function to be applied to each column
|
| 174 |
+
dtype_mapping: dict or None
|
| 175 |
+
If not None, maps a dtype to a result dtype.
|
| 176 |
+
Otherwise, will fall back to default mapping.
|
| 177 |
+
is_grouped_kernel: bool, default False
|
| 178 |
+
Whether func operates using the group labels (True)
|
| 179 |
+
or using starts/ends arrays
|
| 180 |
+
|
| 181 |
+
If true, you also need to pass the number of groups to this function
|
| 182 |
+
nopython : bool
|
| 183 |
+
nopython to be passed into numba.jit
|
| 184 |
+
nogil : bool
|
| 185 |
+
nogil to be passed into numba.jit
|
| 186 |
+
parallel : bool
|
| 187 |
+
parallel to be passed into numba.jit
|
| 188 |
+
|
| 189 |
+
Returns
|
| 190 |
+
-------
|
| 191 |
+
Numba function
|
| 192 |
+
"""
|
| 193 |
+
|
| 194 |
+
# A wrapper around the looper function,
|
| 195 |
+
# to dispatch based on dtype since numba is unable to do that in nopython mode
|
| 196 |
+
|
| 197 |
+
# It also post-processes the values by inserting nans where number of observations
|
| 198 |
+
# is less than min_periods
|
| 199 |
+
# Cannot do this in numba nopython mode
|
| 200 |
+
# (you'll run into type-unification error when you cast int -> float)
|
| 201 |
+
def looper_wrapper(
|
| 202 |
+
values,
|
| 203 |
+
start=None,
|
| 204 |
+
end=None,
|
| 205 |
+
labels=None,
|
| 206 |
+
ngroups=None,
|
| 207 |
+
min_periods: int = 0,
|
| 208 |
+
**kwargs,
|
| 209 |
+
):
|
| 210 |
+
result_dtype = dtype_mapping[values.dtype]
|
| 211 |
+
column_looper = make_looper(
|
| 212 |
+
func, result_dtype, is_grouped_kernel, nopython, nogil, parallel
|
| 213 |
+
)
|
| 214 |
+
# Need to unpack kwargs since numba only supports *args
|
| 215 |
+
if is_grouped_kernel:
|
| 216 |
+
result, na_positions = column_looper(
|
| 217 |
+
values, labels, ngroups, min_periods, *kwargs.values()
|
| 218 |
+
)
|
| 219 |
+
else:
|
| 220 |
+
result, na_positions = column_looper(
|
| 221 |
+
values, start, end, min_periods, *kwargs.values()
|
| 222 |
+
)
|
| 223 |
+
if result.dtype.kind == "i":
|
| 224 |
+
# Look if na_positions is not empty
|
| 225 |
+
# If so, convert the whole block
|
| 226 |
+
# This is OK since int dtype cannot hold nan,
|
| 227 |
+
# so if min_periods not satisfied for 1 col, it is not satisfied for
|
| 228 |
+
# all columns at that index
|
| 229 |
+
for na_pos in na_positions.values():
|
| 230 |
+
if len(na_pos) > 0:
|
| 231 |
+
result = result.astype("float64")
|
| 232 |
+
break
|
| 233 |
+
# TODO: Optimize this
|
| 234 |
+
for i, na_pos in na_positions.items():
|
| 235 |
+
if len(na_pos) > 0:
|
| 236 |
+
result[i, na_pos] = np.nan
|
| 237 |
+
return result
|
| 238 |
+
|
| 239 |
+
return looper_wrapper
|
venv/lib/python3.10/site-packages/pandas/core/_numba/extensions.py
ADDED
|
@@ -0,0 +1,584 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Disable type checking for this module since numba's internals
|
| 2 |
+
# are not typed, and we use numba's internals via its extension API
|
| 3 |
+
# mypy: ignore-errors
|
| 4 |
+
"""
|
| 5 |
+
Utility classes/functions to let numba recognize
|
| 6 |
+
pandas Index/Series/DataFrame
|
| 7 |
+
|
| 8 |
+
Mostly vendored from https://github.com/numba/numba/blob/main/numba/tests/pdlike_usecase.py
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
from contextlib import contextmanager
|
| 14 |
+
import operator
|
| 15 |
+
|
| 16 |
+
import numba
|
| 17 |
+
from numba import types
|
| 18 |
+
from numba.core import cgutils
|
| 19 |
+
from numba.core.datamodel import models
|
| 20 |
+
from numba.core.extending import (
|
| 21 |
+
NativeValue,
|
| 22 |
+
box,
|
| 23 |
+
lower_builtin,
|
| 24 |
+
make_attribute_wrapper,
|
| 25 |
+
overload,
|
| 26 |
+
overload_attribute,
|
| 27 |
+
overload_method,
|
| 28 |
+
register_model,
|
| 29 |
+
type_callable,
|
| 30 |
+
typeof_impl,
|
| 31 |
+
unbox,
|
| 32 |
+
)
|
| 33 |
+
from numba.core.imputils import impl_ret_borrowed
|
| 34 |
+
import numpy as np
|
| 35 |
+
|
| 36 |
+
from pandas._libs import lib
|
| 37 |
+
|
| 38 |
+
from pandas.core.indexes.base import Index
|
| 39 |
+
from pandas.core.indexing import _iLocIndexer
|
| 40 |
+
from pandas.core.internals import SingleBlockManager
|
| 41 |
+
from pandas.core.series import Series
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
# Helper function to hack around fact that Index casts numpy string dtype to object
|
| 45 |
+
#
|
| 46 |
+
# Idea is to set an attribute on a Index called _numba_data
|
| 47 |
+
# that is the original data, or the object data casted to numpy string dtype,
|
| 48 |
+
# with a context manager that is unset afterwards
|
| 49 |
+
@contextmanager
|
| 50 |
+
def set_numba_data(index: Index):
|
| 51 |
+
numba_data = index._data
|
| 52 |
+
if numba_data.dtype == object:
|
| 53 |
+
if not lib.is_string_array(numba_data):
|
| 54 |
+
raise ValueError(
|
| 55 |
+
"The numba engine only supports using string or numeric column names"
|
| 56 |
+
)
|
| 57 |
+
numba_data = numba_data.astype("U")
|
| 58 |
+
try:
|
| 59 |
+
index._numba_data = numba_data
|
| 60 |
+
yield index
|
| 61 |
+
finally:
|
| 62 |
+
del index._numba_data
|
| 63 |
+
|
| 64 |
+
|
| 65 |
+
# TODO: Range index support
|
| 66 |
+
# (this currently lowers OK, but does not round-trip)
|
| 67 |
+
class IndexType(types.Type):
|
| 68 |
+
"""
|
| 69 |
+
The type class for Index objects.
|
| 70 |
+
"""
|
| 71 |
+
|
| 72 |
+
def __init__(self, dtype, layout, pyclass: any) -> None:
|
| 73 |
+
self.pyclass = pyclass
|
| 74 |
+
name = f"index({dtype}, {layout})"
|
| 75 |
+
self.dtype = dtype
|
| 76 |
+
self.layout = layout
|
| 77 |
+
super().__init__(name)
|
| 78 |
+
|
| 79 |
+
@property
|
| 80 |
+
def key(self):
|
| 81 |
+
return self.pyclass, self.dtype, self.layout
|
| 82 |
+
|
| 83 |
+
@property
|
| 84 |
+
def as_array(self):
|
| 85 |
+
return types.Array(self.dtype, 1, self.layout)
|
| 86 |
+
|
| 87 |
+
def copy(self, dtype=None, ndim: int = 1, layout=None):
|
| 88 |
+
assert ndim == 1
|
| 89 |
+
if dtype is None:
|
| 90 |
+
dtype = self.dtype
|
| 91 |
+
layout = layout or self.layout
|
| 92 |
+
return type(self)(dtype, layout, self.pyclass)
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
class SeriesType(types.Type):
|
| 96 |
+
"""
|
| 97 |
+
The type class for Series objects.
|
| 98 |
+
"""
|
| 99 |
+
|
| 100 |
+
def __init__(self, dtype, index, namety) -> None:
|
| 101 |
+
assert isinstance(index, IndexType)
|
| 102 |
+
self.dtype = dtype
|
| 103 |
+
self.index = index
|
| 104 |
+
self.values = types.Array(self.dtype, 1, "C")
|
| 105 |
+
self.namety = namety
|
| 106 |
+
name = f"series({dtype}, {index}, {namety})"
|
| 107 |
+
super().__init__(name)
|
| 108 |
+
|
| 109 |
+
@property
|
| 110 |
+
def key(self):
|
| 111 |
+
return self.dtype, self.index, self.namety
|
| 112 |
+
|
| 113 |
+
@property
|
| 114 |
+
def as_array(self):
|
| 115 |
+
return self.values
|
| 116 |
+
|
| 117 |
+
def copy(self, dtype=None, ndim: int = 1, layout: str = "C"):
|
| 118 |
+
assert ndim == 1
|
| 119 |
+
assert layout == "C"
|
| 120 |
+
if dtype is None:
|
| 121 |
+
dtype = self.dtype
|
| 122 |
+
return type(self)(dtype, self.index, self.namety)
|
| 123 |
+
|
| 124 |
+
|
| 125 |
+
@typeof_impl.register(Index)
|
| 126 |
+
def typeof_index(val, c):
|
| 127 |
+
"""
|
| 128 |
+
This will assume that only strings are in object dtype
|
| 129 |
+
index.
|
| 130 |
+
(you should check this before this gets lowered down to numba)
|
| 131 |
+
"""
|
| 132 |
+
# arrty = typeof_impl(val._data, c)
|
| 133 |
+
arrty = typeof_impl(val._numba_data, c)
|
| 134 |
+
assert arrty.ndim == 1
|
| 135 |
+
return IndexType(arrty.dtype, arrty.layout, type(val))
|
| 136 |
+
|
| 137 |
+
|
| 138 |
+
@typeof_impl.register(Series)
|
| 139 |
+
def typeof_series(val, c):
|
| 140 |
+
index = typeof_impl(val.index, c)
|
| 141 |
+
arrty = typeof_impl(val.values, c)
|
| 142 |
+
namety = typeof_impl(val.name, c)
|
| 143 |
+
assert arrty.ndim == 1
|
| 144 |
+
assert arrty.layout == "C"
|
| 145 |
+
return SeriesType(arrty.dtype, index, namety)
|
| 146 |
+
|
| 147 |
+
|
| 148 |
+
@type_callable(Series)
|
| 149 |
+
def type_series_constructor(context):
|
| 150 |
+
def typer(data, index, name=None):
|
| 151 |
+
if isinstance(index, IndexType) and isinstance(data, types.Array):
|
| 152 |
+
assert data.ndim == 1
|
| 153 |
+
if name is None:
|
| 154 |
+
name = types.intp
|
| 155 |
+
return SeriesType(data.dtype, index, name)
|
| 156 |
+
|
| 157 |
+
return typer
|
| 158 |
+
|
| 159 |
+
|
| 160 |
+
@type_callable(Index)
|
| 161 |
+
def type_index_constructor(context):
|
| 162 |
+
def typer(data, hashmap=None):
|
| 163 |
+
if isinstance(data, types.Array):
|
| 164 |
+
assert data.layout == "C"
|
| 165 |
+
assert data.ndim == 1
|
| 166 |
+
assert hashmap is None or isinstance(hashmap, types.DictType)
|
| 167 |
+
return IndexType(data.dtype, layout=data.layout, pyclass=Index)
|
| 168 |
+
|
| 169 |
+
return typer
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
# Backend extensions for Index and Series and Frame
|
| 173 |
+
@register_model(IndexType)
|
| 174 |
+
class IndexModel(models.StructModel):
|
| 175 |
+
def __init__(self, dmm, fe_type) -> None:
|
| 176 |
+
# We don't want the numpy string scalar type in our hashmap
|
| 177 |
+
members = [
|
| 178 |
+
("data", fe_type.as_array),
|
| 179 |
+
# This is an attempt to emulate our hashtable code with a numba
|
| 180 |
+
# typed dict
|
| 181 |
+
# It maps from values in the index to their integer positions in the array
|
| 182 |
+
("hashmap", types.DictType(fe_type.dtype, types.intp)),
|
| 183 |
+
# Pointer to the Index object this was created from, or that it
|
| 184 |
+
# boxes to
|
| 185 |
+
# https://numba.discourse.group/t/qst-how-to-cache-the-boxing-of-an-object/2128/2?u=lithomas1
|
| 186 |
+
("parent", types.pyobject),
|
| 187 |
+
]
|
| 188 |
+
models.StructModel.__init__(self, dmm, fe_type, members)
|
| 189 |
+
|
| 190 |
+
|
| 191 |
+
@register_model(SeriesType)
|
| 192 |
+
class SeriesModel(models.StructModel):
|
| 193 |
+
def __init__(self, dmm, fe_type) -> None:
|
| 194 |
+
members = [
|
| 195 |
+
("index", fe_type.index),
|
| 196 |
+
("values", fe_type.as_array),
|
| 197 |
+
("name", fe_type.namety),
|
| 198 |
+
]
|
| 199 |
+
models.StructModel.__init__(self, dmm, fe_type, members)
|
| 200 |
+
|
| 201 |
+
|
| 202 |
+
make_attribute_wrapper(IndexType, "data", "_data")
|
| 203 |
+
make_attribute_wrapper(IndexType, "hashmap", "hashmap")
|
| 204 |
+
|
| 205 |
+
make_attribute_wrapper(SeriesType, "index", "index")
|
| 206 |
+
make_attribute_wrapper(SeriesType, "values", "values")
|
| 207 |
+
make_attribute_wrapper(SeriesType, "name", "name")
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
@lower_builtin(Series, types.Array, IndexType)
|
| 211 |
+
def pdseries_constructor(context, builder, sig, args):
|
| 212 |
+
data, index = args
|
| 213 |
+
series = cgutils.create_struct_proxy(sig.return_type)(context, builder)
|
| 214 |
+
series.index = index
|
| 215 |
+
series.values = data
|
| 216 |
+
series.name = context.get_constant(types.intp, 0)
|
| 217 |
+
return impl_ret_borrowed(context, builder, sig.return_type, series._getvalue())
|
| 218 |
+
|
| 219 |
+
|
| 220 |
+
@lower_builtin(Series, types.Array, IndexType, types.intp)
|
| 221 |
+
@lower_builtin(Series, types.Array, IndexType, types.float64)
|
| 222 |
+
@lower_builtin(Series, types.Array, IndexType, types.unicode_type)
|
| 223 |
+
def pdseries_constructor_with_name(context, builder, sig, args):
|
| 224 |
+
data, index, name = args
|
| 225 |
+
series = cgutils.create_struct_proxy(sig.return_type)(context, builder)
|
| 226 |
+
series.index = index
|
| 227 |
+
series.values = data
|
| 228 |
+
series.name = name
|
| 229 |
+
return impl_ret_borrowed(context, builder, sig.return_type, series._getvalue())
|
| 230 |
+
|
| 231 |
+
|
| 232 |
+
@lower_builtin(Index, types.Array, types.DictType, types.pyobject)
|
| 233 |
+
def index_constructor_2arg(context, builder, sig, args):
|
| 234 |
+
(data, hashmap, parent) = args
|
| 235 |
+
index = cgutils.create_struct_proxy(sig.return_type)(context, builder)
|
| 236 |
+
|
| 237 |
+
index.data = data
|
| 238 |
+
index.hashmap = hashmap
|
| 239 |
+
index.parent = parent
|
| 240 |
+
return impl_ret_borrowed(context, builder, sig.return_type, index._getvalue())
|
| 241 |
+
|
| 242 |
+
|
| 243 |
+
@lower_builtin(Index, types.Array, types.DictType)
|
| 244 |
+
def index_constructor_2arg_parent(context, builder, sig, args):
|
| 245 |
+
# Basically same as index_constructor_1arg, but also lets you specify the
|
| 246 |
+
# parent object
|
| 247 |
+
(data, hashmap) = args
|
| 248 |
+
index = cgutils.create_struct_proxy(sig.return_type)(context, builder)
|
| 249 |
+
|
| 250 |
+
index.data = data
|
| 251 |
+
index.hashmap = hashmap
|
| 252 |
+
return impl_ret_borrowed(context, builder, sig.return_type, index._getvalue())
|
| 253 |
+
|
| 254 |
+
|
| 255 |
+
@lower_builtin(Index, types.Array)
|
| 256 |
+
def index_constructor_1arg(context, builder, sig, args):
|
| 257 |
+
from numba.typed import Dict
|
| 258 |
+
|
| 259 |
+
key_type = sig.return_type.dtype
|
| 260 |
+
value_type = types.intp
|
| 261 |
+
|
| 262 |
+
def index_impl(data):
|
| 263 |
+
return Index(data, Dict.empty(key_type, value_type))
|
| 264 |
+
|
| 265 |
+
return context.compile_internal(builder, index_impl, sig, args)
|
| 266 |
+
|
| 267 |
+
|
| 268 |
+
# Helper to convert the unicodecharseq (numpy string scalar) into a unicode_type
|
| 269 |
+
# (regular string)
|
| 270 |
+
def maybe_cast_str(x):
|
| 271 |
+
# Dummy function that numba can overload
|
| 272 |
+
pass
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
@overload(maybe_cast_str)
|
| 276 |
+
def maybe_cast_str_impl(x):
|
| 277 |
+
"""Converts numba UnicodeCharSeq (numpy string scalar) -> unicode type (string).
|
| 278 |
+
Is a no-op for other types."""
|
| 279 |
+
if isinstance(x, types.UnicodeCharSeq):
|
| 280 |
+
return lambda x: str(x)
|
| 281 |
+
else:
|
| 282 |
+
return lambda x: x
|
| 283 |
+
|
| 284 |
+
|
| 285 |
+
@unbox(IndexType)
|
| 286 |
+
def unbox_index(typ, obj, c):
|
| 287 |
+
"""
|
| 288 |
+
Convert a Index object to a native structure.
|
| 289 |
+
|
| 290 |
+
Note: Object dtype is not allowed here
|
| 291 |
+
"""
|
| 292 |
+
data_obj = c.pyapi.object_getattr_string(obj, "_numba_data")
|
| 293 |
+
index = cgutils.create_struct_proxy(typ)(c.context, c.builder)
|
| 294 |
+
# If we see an object array, assume its been validated as only containing strings
|
| 295 |
+
# We still need to do the conversion though
|
| 296 |
+
index.data = c.unbox(typ.as_array, data_obj).value
|
| 297 |
+
typed_dict_obj = c.pyapi.unserialize(c.pyapi.serialize_object(numba.typed.Dict))
|
| 298 |
+
# Create an empty typed dict in numba for the hashmap for indexing
|
| 299 |
+
# equiv of numba.typed.Dict.empty(typ.dtype, types.intp)
|
| 300 |
+
arr_type_obj = c.pyapi.unserialize(c.pyapi.serialize_object(typ.dtype))
|
| 301 |
+
intp_type_obj = c.pyapi.unserialize(c.pyapi.serialize_object(types.intp))
|
| 302 |
+
hashmap_obj = c.pyapi.call_method(
|
| 303 |
+
typed_dict_obj, "empty", (arr_type_obj, intp_type_obj)
|
| 304 |
+
)
|
| 305 |
+
index.hashmap = c.unbox(types.DictType(typ.dtype, types.intp), hashmap_obj).value
|
| 306 |
+
# Set the parent for speedy boxing.
|
| 307 |
+
index.parent = obj
|
| 308 |
+
|
| 309 |
+
# Decrefs
|
| 310 |
+
c.pyapi.decref(data_obj)
|
| 311 |
+
c.pyapi.decref(arr_type_obj)
|
| 312 |
+
c.pyapi.decref(intp_type_obj)
|
| 313 |
+
c.pyapi.decref(typed_dict_obj)
|
| 314 |
+
|
| 315 |
+
return NativeValue(index._getvalue())
|
| 316 |
+
|
| 317 |
+
|
| 318 |
+
@unbox(SeriesType)
|
| 319 |
+
def unbox_series(typ, obj, c):
|
| 320 |
+
"""
|
| 321 |
+
Convert a Series object to a native structure.
|
| 322 |
+
"""
|
| 323 |
+
index_obj = c.pyapi.object_getattr_string(obj, "index")
|
| 324 |
+
values_obj = c.pyapi.object_getattr_string(obj, "values")
|
| 325 |
+
name_obj = c.pyapi.object_getattr_string(obj, "name")
|
| 326 |
+
|
| 327 |
+
series = cgutils.create_struct_proxy(typ)(c.context, c.builder)
|
| 328 |
+
series.index = c.unbox(typ.index, index_obj).value
|
| 329 |
+
series.values = c.unbox(typ.values, values_obj).value
|
| 330 |
+
series.name = c.unbox(typ.namety, name_obj).value
|
| 331 |
+
|
| 332 |
+
# Decrefs
|
| 333 |
+
c.pyapi.decref(index_obj)
|
| 334 |
+
c.pyapi.decref(values_obj)
|
| 335 |
+
c.pyapi.decref(name_obj)
|
| 336 |
+
|
| 337 |
+
return NativeValue(series._getvalue())
|
| 338 |
+
|
| 339 |
+
|
| 340 |
+
@box(IndexType)
|
| 341 |
+
def box_index(typ, val, c):
|
| 342 |
+
"""
|
| 343 |
+
Convert a native index structure to a Index object.
|
| 344 |
+
|
| 345 |
+
If our native index is of a numpy string dtype, we'll cast it to
|
| 346 |
+
object.
|
| 347 |
+
"""
|
| 348 |
+
# First build a Numpy array object, then wrap it in a Index
|
| 349 |
+
index = cgutils.create_struct_proxy(typ)(c.context, c.builder, value=val)
|
| 350 |
+
|
| 351 |
+
res = cgutils.alloca_once_value(c.builder, index.parent)
|
| 352 |
+
|
| 353 |
+
# Does parent exist?
|
| 354 |
+
# (it means already boxed once, or Index same as original df.index or df.columns)
|
| 355 |
+
# xref https://github.com/numba/numba/blob/596e8a55334cc46854e3192766e643767bd7c934/numba/core/boxing.py#L593C17-L593C17
|
| 356 |
+
with c.builder.if_else(cgutils.is_not_null(c.builder, index.parent)) as (
|
| 357 |
+
has_parent,
|
| 358 |
+
otherwise,
|
| 359 |
+
):
|
| 360 |
+
with has_parent:
|
| 361 |
+
c.pyapi.incref(index.parent)
|
| 362 |
+
with otherwise:
|
| 363 |
+
# TODO: preserve the original class for the index
|
| 364 |
+
# Also need preserve the name of the Index
|
| 365 |
+
# class_obj = c.pyapi.unserialize(c.pyapi.serialize_object(typ.pyclass))
|
| 366 |
+
class_obj = c.pyapi.unserialize(c.pyapi.serialize_object(Index))
|
| 367 |
+
array_obj = c.box(typ.as_array, index.data)
|
| 368 |
+
if isinstance(typ.dtype, types.UnicodeCharSeq):
|
| 369 |
+
# We converted to numpy string dtype, convert back
|
| 370 |
+
# to object since _simple_new won't do that for uss
|
| 371 |
+
object_str_obj = c.pyapi.unserialize(c.pyapi.serialize_object("object"))
|
| 372 |
+
array_obj = c.pyapi.call_method(array_obj, "astype", (object_str_obj,))
|
| 373 |
+
c.pyapi.decref(object_str_obj)
|
| 374 |
+
# this is basically Index._simple_new(array_obj, name_obj) in python
|
| 375 |
+
index_obj = c.pyapi.call_method(class_obj, "_simple_new", (array_obj,))
|
| 376 |
+
index.parent = index_obj
|
| 377 |
+
c.builder.store(index_obj, res)
|
| 378 |
+
|
| 379 |
+
# Decrefs
|
| 380 |
+
c.pyapi.decref(class_obj)
|
| 381 |
+
c.pyapi.decref(array_obj)
|
| 382 |
+
return c.builder.load(res)
|
| 383 |
+
|
| 384 |
+
|
| 385 |
+
@box(SeriesType)
|
| 386 |
+
def box_series(typ, val, c):
|
| 387 |
+
"""
|
| 388 |
+
Convert a native series structure to a Series object.
|
| 389 |
+
"""
|
| 390 |
+
series = cgutils.create_struct_proxy(typ)(c.context, c.builder, value=val)
|
| 391 |
+
series_const_obj = c.pyapi.unserialize(c.pyapi.serialize_object(Series._from_mgr))
|
| 392 |
+
mgr_const_obj = c.pyapi.unserialize(
|
| 393 |
+
c.pyapi.serialize_object(SingleBlockManager.from_array)
|
| 394 |
+
)
|
| 395 |
+
index_obj = c.box(typ.index, series.index)
|
| 396 |
+
array_obj = c.box(typ.as_array, series.values)
|
| 397 |
+
name_obj = c.box(typ.namety, series.name)
|
| 398 |
+
# This is basically equivalent of
|
| 399 |
+
# pd.Series(data=array_obj, index=index_obj)
|
| 400 |
+
# To improve perf, we will construct the Series from a manager
|
| 401 |
+
# object to avoid checks.
|
| 402 |
+
# We'll also set the name attribute manually to avoid validation
|
| 403 |
+
mgr_obj = c.pyapi.call_function_objargs(
|
| 404 |
+
mgr_const_obj,
|
| 405 |
+
(
|
| 406 |
+
array_obj,
|
| 407 |
+
index_obj,
|
| 408 |
+
),
|
| 409 |
+
)
|
| 410 |
+
mgr_axes_obj = c.pyapi.object_getattr_string(mgr_obj, "axes")
|
| 411 |
+
# Series._constructor_from_mgr(mgr, axes)
|
| 412 |
+
series_obj = c.pyapi.call_function_objargs(
|
| 413 |
+
series_const_obj, (mgr_obj, mgr_axes_obj)
|
| 414 |
+
)
|
| 415 |
+
c.pyapi.object_setattr_string(series_obj, "_name", name_obj)
|
| 416 |
+
|
| 417 |
+
# Decrefs
|
| 418 |
+
c.pyapi.decref(series_const_obj)
|
| 419 |
+
c.pyapi.decref(mgr_axes_obj)
|
| 420 |
+
c.pyapi.decref(mgr_obj)
|
| 421 |
+
c.pyapi.decref(mgr_const_obj)
|
| 422 |
+
c.pyapi.decref(index_obj)
|
| 423 |
+
c.pyapi.decref(array_obj)
|
| 424 |
+
c.pyapi.decref(name_obj)
|
| 425 |
+
|
| 426 |
+
return series_obj
|
| 427 |
+
|
| 428 |
+
|
| 429 |
+
# Add common series reductions (e.g. mean, sum),
|
| 430 |
+
# and also add common binops (e.g. add, sub, mul, div)
|
| 431 |
+
def generate_series_reduction(ser_reduction, ser_method):
|
| 432 |
+
@overload_method(SeriesType, ser_reduction)
|
| 433 |
+
def series_reduction(series):
|
| 434 |
+
def series_reduction_impl(series):
|
| 435 |
+
return ser_method(series.values)
|
| 436 |
+
|
| 437 |
+
return series_reduction_impl
|
| 438 |
+
|
| 439 |
+
return series_reduction
|
| 440 |
+
|
| 441 |
+
|
| 442 |
+
def generate_series_binop(binop):
|
| 443 |
+
@overload(binop)
|
| 444 |
+
def series_binop(series1, value):
|
| 445 |
+
if isinstance(series1, SeriesType):
|
| 446 |
+
if isinstance(value, SeriesType):
|
| 447 |
+
|
| 448 |
+
def series_binop_impl(series1, series2):
|
| 449 |
+
# TODO: Check index matching?
|
| 450 |
+
return Series(
|
| 451 |
+
binop(series1.values, series2.values),
|
| 452 |
+
series1.index,
|
| 453 |
+
series1.name,
|
| 454 |
+
)
|
| 455 |
+
|
| 456 |
+
return series_binop_impl
|
| 457 |
+
else:
|
| 458 |
+
|
| 459 |
+
def series_binop_impl(series1, value):
|
| 460 |
+
return Series(
|
| 461 |
+
binop(series1.values, value), series1.index, series1.name
|
| 462 |
+
)
|
| 463 |
+
|
| 464 |
+
return series_binop_impl
|
| 465 |
+
|
| 466 |
+
return series_binop
|
| 467 |
+
|
| 468 |
+
|
| 469 |
+
series_reductions = [
|
| 470 |
+
("sum", np.sum),
|
| 471 |
+
("mean", np.mean),
|
| 472 |
+
# Disabled due to discrepancies between numba std. dev
|
| 473 |
+
# and pandas std. dev (no way to specify dof)
|
| 474 |
+
# ("std", np.std),
|
| 475 |
+
# ("var", np.var),
|
| 476 |
+
("min", np.min),
|
| 477 |
+
("max", np.max),
|
| 478 |
+
]
|
| 479 |
+
for reduction, reduction_method in series_reductions:
|
| 480 |
+
generate_series_reduction(reduction, reduction_method)
|
| 481 |
+
|
| 482 |
+
series_binops = [operator.add, operator.sub, operator.mul, operator.truediv]
|
| 483 |
+
|
| 484 |
+
for ser_binop in series_binops:
|
| 485 |
+
generate_series_binop(ser_binop)
|
| 486 |
+
|
| 487 |
+
|
| 488 |
+
# get_loc on Index
|
| 489 |
+
@overload_method(IndexType, "get_loc")
|
| 490 |
+
def index_get_loc(index, item):
|
| 491 |
+
def index_get_loc_impl(index, item):
|
| 492 |
+
# Initialize the hash table if not initialized
|
| 493 |
+
if len(index.hashmap) == 0:
|
| 494 |
+
for i, val in enumerate(index._data):
|
| 495 |
+
index.hashmap[val] = i
|
| 496 |
+
return index.hashmap[item]
|
| 497 |
+
|
| 498 |
+
return index_get_loc_impl
|
| 499 |
+
|
| 500 |
+
|
| 501 |
+
# Indexing for Series/Index
|
| 502 |
+
@overload(operator.getitem)
|
| 503 |
+
def series_indexing(series, item):
|
| 504 |
+
if isinstance(series, SeriesType):
|
| 505 |
+
|
| 506 |
+
def series_getitem(series, item):
|
| 507 |
+
loc = series.index.get_loc(item)
|
| 508 |
+
return series.iloc[loc]
|
| 509 |
+
|
| 510 |
+
return series_getitem
|
| 511 |
+
|
| 512 |
+
|
| 513 |
+
@overload(operator.getitem)
|
| 514 |
+
def index_indexing(index, idx):
|
| 515 |
+
if isinstance(index, IndexType):
|
| 516 |
+
|
| 517 |
+
def index_getitem(index, idx):
|
| 518 |
+
return index._data[idx]
|
| 519 |
+
|
| 520 |
+
return index_getitem
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
class IlocType(types.Type):
|
| 524 |
+
def __init__(self, obj_type) -> None:
|
| 525 |
+
self.obj_type = obj_type
|
| 526 |
+
name = f"iLocIndexer({obj_type})"
|
| 527 |
+
super().__init__(name=name)
|
| 528 |
+
|
| 529 |
+
@property
|
| 530 |
+
def key(self):
|
| 531 |
+
return self.obj_type
|
| 532 |
+
|
| 533 |
+
|
| 534 |
+
@typeof_impl.register(_iLocIndexer)
|
| 535 |
+
def typeof_iloc(val, c):
|
| 536 |
+
objtype = typeof_impl(val.obj, c)
|
| 537 |
+
return IlocType(objtype)
|
| 538 |
+
|
| 539 |
+
|
| 540 |
+
@type_callable(_iLocIndexer)
|
| 541 |
+
def type_iloc_constructor(context):
|
| 542 |
+
def typer(obj):
|
| 543 |
+
if isinstance(obj, SeriesType):
|
| 544 |
+
return IlocType(obj)
|
| 545 |
+
|
| 546 |
+
return typer
|
| 547 |
+
|
| 548 |
+
|
| 549 |
+
@lower_builtin(_iLocIndexer, SeriesType)
|
| 550 |
+
def iloc_constructor(context, builder, sig, args):
|
| 551 |
+
(obj,) = args
|
| 552 |
+
iloc_indexer = cgutils.create_struct_proxy(sig.return_type)(context, builder)
|
| 553 |
+
iloc_indexer.obj = obj
|
| 554 |
+
return impl_ret_borrowed(
|
| 555 |
+
context, builder, sig.return_type, iloc_indexer._getvalue()
|
| 556 |
+
)
|
| 557 |
+
|
| 558 |
+
|
| 559 |
+
@register_model(IlocType)
|
| 560 |
+
class ILocModel(models.StructModel):
|
| 561 |
+
def __init__(self, dmm, fe_type) -> None:
|
| 562 |
+
members = [("obj", fe_type.obj_type)]
|
| 563 |
+
models.StructModel.__init__(self, dmm, fe_type, members)
|
| 564 |
+
|
| 565 |
+
|
| 566 |
+
make_attribute_wrapper(IlocType, "obj", "obj")
|
| 567 |
+
|
| 568 |
+
|
| 569 |
+
@overload_attribute(SeriesType, "iloc")
|
| 570 |
+
def series_iloc(series):
|
| 571 |
+
def get(series):
|
| 572 |
+
return _iLocIndexer(series)
|
| 573 |
+
|
| 574 |
+
return get
|
| 575 |
+
|
| 576 |
+
|
| 577 |
+
@overload(operator.getitem)
|
| 578 |
+
def iloc_getitem(iloc_indexer, i):
|
| 579 |
+
if isinstance(iloc_indexer, IlocType):
|
| 580 |
+
|
| 581 |
+
def getitem_impl(iloc_indexer, i):
|
| 582 |
+
return iloc_indexer.obj.values[i]
|
| 583 |
+
|
| 584 |
+
return getitem_impl
|
venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (626 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/mean_.cpython-310.pyc
ADDED
|
Binary file (3.49 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/min_max_.cpython-310.pyc
ADDED
|
Binary file (2.45 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/shared.cpython-310.pyc
ADDED
|
Binary file (785 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/sum_.cpython-310.pyc
ADDED
|
Binary file (3.81 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/_numba/kernels/__pycache__/var_.cpython-310.pyc
ADDED
|
Binary file (3.95 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/computation/__init__.py
ADDED
|
File without changes
|
venv/lib/python3.10/site-packages/pandas/core/computation/__pycache__/__init__.cpython-310.pyc
ADDED
|
Binary file (191 Bytes). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/computation/__pycache__/align.cpython-310.pyc
ADDED
|
Binary file (6.12 kB). View file
|
|
|
venv/lib/python3.10/site-packages/pandas/core/computation/__pycache__/api.cpython-310.pyc
ADDED
|
Binary file (265 Bytes). View file
|
|
|