|
| 1 | +# Note: this covers algos.pyx and algos_common_helper but NOT algos_take_helper |
| 2 | +from typing import Any |
| 3 | + |
| 4 | +import numpy as np |
| 5 | + |
| 6 | +class Infinity: |
| 7 | + """ |
| 8 | + Provide a positive Infinity comparison method for ranking. |
| 9 | + """ |
| 10 | + def __eq__(self, other) -> bool: ... |
| 11 | + def __ne__(self, other) -> bool: ... |
| 12 | + def __lt__(self, other) -> bool: ... |
| 13 | + def __le__(self, other) -> bool: ... |
| 14 | + def __gt__(self, other) -> bool: ... |
| 15 | + def __ge__(self, other) -> bool: ... |
| 16 | + |
| 17 | + |
| 18 | +class NegInfinity: |
| 19 | + """ |
| 20 | + Provide a negative Infinity comparison method for ranking. |
| 21 | + """ |
| 22 | + def __eq__(self, other) -> bool: ... |
| 23 | + def __ne__(self, other) -> bool: ... |
| 24 | + def __lt__(self, other) -> bool: ... |
| 25 | + def __le__(self, other) -> bool: ... |
| 26 | + def __gt__(self, other) -> bool: ... |
| 27 | + def __ge__(self, other) -> bool: ... |
| 28 | + |
| 29 | + |
| 30 | +def unique_deltas( |
| 31 | + arr: np.ndarray, # const int64_t[:] |
| 32 | +) -> np.ndarray: ... # np.ndarray[np.int64, ndim=1] |
| 33 | + |
| 34 | + |
| 35 | +def is_lexsorted(list_of_arrays: list[np.ndarray]) -> bool: ... |
| 36 | + |
| 37 | + |
| 38 | +def groupsort_indexer( |
| 39 | + index: np.ndarray, # const int64_t[:] |
| 40 | + ngroups: int, |
| 41 | +) -> tuple[ |
| 42 | + np.ndarray, # ndarray[int64_t, ndim=1] |
| 43 | + np.ndarray, # ndarray[int64_t, ndim=1] |
| 44 | +]: |
| 45 | + ... |
| 46 | + |
| 47 | + |
| 48 | +def kth_smallest( |
| 49 | + a: np.ndarray, # numeric[:] |
| 50 | + k: int, |
| 51 | +) -> Any: ... # numeric |
| 52 | + |
| 53 | + |
| 54 | +# ---------------------------------------------------------------------- |
| 55 | +# Pairwise correlation/covariance |
| 56 | + |
| 57 | + |
| 58 | + |
| 59 | +def nancorr( |
| 60 | + mat: np.ndarray, # const float64_t[:, :] |
| 61 | + cov: bool = False, |
| 62 | + minp=None, |
| 63 | +) -> np.ndarray: # np.ndarray[float64_t, ndim=2] |
| 64 | + ... |
| 65 | + |
| 66 | + |
| 67 | +def nancorr_spearman( |
| 68 | + mat: np.ndarray, # ndarray[float64_t, ndim=2] |
| 69 | + minp: int = 1, |
| 70 | +) -> np.ndarray: # np.ndarray[np.float64, ndim=2] |
| 71 | + ... |
| 72 | + |
| 73 | + |
| 74 | +def nancorr_kendall( |
| 75 | + mat: np.ndarray, # ndarray[float64_t, ndim=2] |
| 76 | + minp: int = 1, |
| 77 | +) -> np.ndarray: # np.ndarray[float64, ndim=2] |
| 78 | + ... |
| 79 | + |
| 80 | +# ---------------------------------------------------------------------- |
| 81 | + |
| 82 | +# ctypedef fused algos_t: |
| 83 | +# float64_t |
| 84 | +# float32_t |
| 85 | +# object |
| 86 | +# int64_t |
| 87 | +# int32_t |
| 88 | +# int16_t |
| 89 | +# int8_t |
| 90 | +# uint64_t |
| 91 | +# uint32_t |
| 92 | +# uint16_t |
| 93 | +# uint8_t |
| 94 | + |
| 95 | + |
| 96 | +def validate_limit(nobs: int | None, limit=None) -> int: ... |
| 97 | + |
| 98 | + |
| 99 | +def pad( |
| 100 | + old: np.ndarray, # ndarray[algos_t] |
| 101 | + new: np.ndarray, # ndarray[algos_t] |
| 102 | + limit=None, |
| 103 | +) -> np.ndarray: ... # np.ndarray[np.intp, ndim=1] |
| 104 | + |
| 105 | + |
| 106 | +def pad_inplace( |
| 107 | + values: np.ndarray, # algos_t[:] |
| 108 | + mask: np.ndarray, # uint8_t[:] |
| 109 | + limit=None, |
| 110 | +) -> None: ... |
| 111 | + |
| 112 | + |
| 113 | +def pad_2d_inplace( |
| 114 | + values: np.ndarray, # algos_t[:, :] |
| 115 | + mask: np.ndarray, # const uint8_t[:, :] |
| 116 | + limit=None, |
| 117 | +) -> None: |
| 118 | + ... |
| 119 | + |
| 120 | + |
| 121 | +def backfill( |
| 122 | + old: np.ndarray, # ndarray[algos_t] |
| 123 | + new: np.ndarray, # ndarray[algos_t] |
| 124 | + limit=None, |
| 125 | +) -> np.ndarray: # np.ndarray[np.intp, ndim=1] |
| 126 | + ... |
| 127 | + |
| 128 | +def backfill_inplace( |
| 129 | + values: np.ndarray, # algos_t[:] |
| 130 | + mask: np.ndarray, # uint8_t[:] |
| 131 | + limit=None, |
| 132 | +) -> None: ... |
| 133 | + |
| 134 | + |
| 135 | +def backfill_2d_inplace( |
| 136 | + values: np.ndarray, # algos_t[:, :] |
| 137 | + mask: np.ndarray, # const uint8_t[:, :] |
| 138 | + limit=None, |
| 139 | +) -> None: ... |
| 140 | + |
| 141 | + |
| 142 | +def is_monotonic( |
| 143 | + arr: np.ndarray, # ndarray[algos_t, ndim=1] |
| 144 | + timelike: bool |
| 145 | +) -> tuple[bool, bool, bool]: |
| 146 | + ... |
| 147 | + |
| 148 | +# ---------------------------------------------------------------------- |
| 149 | +# rank_1d, rank_2d |
| 150 | +# ---------------------------------------------------------------------- |
| 151 | + |
| 152 | +# ctypedef fused rank_t: |
| 153 | +# object |
| 154 | +# float64_t |
| 155 | +# uint64_t |
| 156 | +# int64_t |
| 157 | + |
| 158 | + |
| 159 | +def rank_1d( |
| 160 | + values: np.ndarray, # ndarray[rank_t, ndim=1] |
| 161 | + labels: np.ndarray, # const int64_t[:] |
| 162 | + is_datetimelike: bool = ..., |
| 163 | + ties_method=..., |
| 164 | + ascending: bool = ..., |
| 165 | + pct: bool = ..., |
| 166 | + na_option=..., |
| 167 | +) -> np.ndarray: ... # np.ndarray[float64_t, ndim=1] |
| 168 | + |
| 169 | + |
| 170 | +def rank_2d( |
| 171 | + in_arr: np.ndarray, # ndarray[rank_t, ndim=2] |
| 172 | + axis: int = ..., |
| 173 | + is_datetimelike: bool = ..., |
| 174 | + ties_method=..., |
| 175 | + ascending: bool = ..., |
| 176 | + na_option=..., |
| 177 | + pct: bool = ..., |
| 178 | +) -> np.ndarray: ... # np.ndarray[float64_t, ndim=1] |
| 179 | + |
| 180 | + |
| 181 | +def diff_2d( |
| 182 | + arr: np.ndarray, # ndarray[diff_t, ndim=2] |
| 183 | + out: np.ndarray, # ndarray[out_t, ndim=2] |
| 184 | + periods: int, |
| 185 | + axis: int, |
| 186 | + datetimelike: bool = ..., |
| 187 | +) -> None: ... |
| 188 | + |
| 189 | + |
| 190 | +def ensure_platform_int(arr: object) -> np.ndarray: ... |
| 191 | + |
| 192 | +def ensure_object(arr: object) -> np.ndarray: ... |
| 193 | + |
| 194 | +def ensure_float64(arr: object, copy=True) -> np.ndarray: ... |
| 195 | + |
| 196 | +def ensure_float32(arr: object, copy=True) -> np.ndarray: ... |
| 197 | + |
| 198 | +def ensure_int8(arr: object, copy=True) -> np.ndarray: ... |
| 199 | + |
| 200 | +def ensure_int16(arr: object, copy=True) -> np.ndarray: ... |
| 201 | + |
| 202 | +def ensure_int32(arr: object, copy=True) -> np.ndarray: ... |
| 203 | + |
| 204 | +def ensure_int64(arr: object, copy=True) -> np.ndarray: ... |
| 205 | + |
| 206 | +def ensure_uint8(arr: object, copy=True) -> np.ndarray: ... |
| 207 | + |
| 208 | +def ensure_uint16(arr: object, copy=True) -> np.ndarray: ... |
| 209 | + |
| 210 | +def ensure_uint32(arr: object, copy=True) -> np.ndarray: ... |
| 211 | + |
| 212 | +def ensure_uint64(arr: object, copy=True) -> np.ndarray: ... |
| 213 | + |
| 214 | + |
| 215 | +def take_1d_int8_int8(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 216 | +def take_1d_int8_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 217 | +def take_1d_int8_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 218 | +def take_1d_int8_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 219 | +def take_1d_int16_int16(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 220 | +def take_1d_int16_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 221 | +def take_1d_int16_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 222 | +def take_1d_int16_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 223 | +def take_1d_int32_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 224 | +def take_1d_int32_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 225 | +def take_1d_int32_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 226 | +def take_1d_int64_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 227 | +def take_1d_int64_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 228 | +def take_1d_float32_float32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 229 | +def take_1d_float32_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 230 | +def take_1d_float64_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 231 | +def take_1d_object_object(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 232 | +def take_1d_bool_bool(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 233 | +def take_1d_bool_object(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 234 | + |
| 235 | +def take_2d_axis0_int8_int8(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 236 | +def take_2d_axis0_int8_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 237 | +def take_2d_axis0_int8_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 238 | +def take_2d_axis0_int8_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 239 | +def take_2d_axis0_int16_int16(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 240 | +def take_2d_axis0_int16_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 241 | +def take_2d_axis0_int16_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 242 | +def take_2d_axis0_int16_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 243 | +def take_2d_axis0_int32_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 244 | +def take_2d_axis0_int32_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 245 | +def take_2d_axis0_int32_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 246 | +def take_2d_axis0_int64_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 247 | +def take_2d_axis0_int64_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 248 | +def take_2d_axis0_float32_float32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 249 | +def take_2d_axis0_float32_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 250 | +def take_2d_axis0_float64_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 251 | +def take_2d_axis0_object_object(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 252 | +def take_2d_axis0_bool_bool(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 253 | +def take_2d_axis0_bool_object(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 254 | + |
| 255 | +def take_2d_axis1_int8_int8(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 256 | +def take_2d_axis1_int8_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 257 | +def take_2d_axis1_int8_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 258 | +def take_2d_axis1_int8_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 259 | +def take_2d_axis1_int16_int16(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 260 | +def take_2d_axis1_int16_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 261 | +def take_2d_axis1_int16_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 262 | +def take_2d_axis1_int16_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 263 | +def take_2d_axis1_int32_int32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 264 | +def take_2d_axis1_int32_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 265 | +def take_2d_axis1_int32_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 266 | +def take_2d_axis1_int64_int64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 267 | +def take_2d_axis1_int64_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 268 | +def take_2d_axis1_float32_float32(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 269 | +def take_2d_axis1_float32_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 270 | +def take_2d_axis1_float64_float64(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 271 | +def take_2d_axis1_object_object(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 272 | +def take_2d_axis1_bool_bool(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 273 | +def take_2d_axis1_bool_object(values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...) -> None: ... |
| 274 | + |
| 275 | +def take_2d_multi_int8_int8(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 276 | +def take_2d_multi_int8_int32(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 277 | +def take_2d_multi_int8_int64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 278 | +def take_2d_multi_int8_float64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 279 | +def take_2d_multi_int16_int16(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 280 | +def take_2d_multi_int16_int32(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 281 | +def take_2d_multi_int16_int64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 282 | +def take_2d_multi_int16_float64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 283 | +def take_2d_multi_int32_int32(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 284 | +def take_2d_multi_int32_int64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 285 | +def take_2d_multi_int32_float64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 286 | +def take_2d_multi_int64_float64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 287 | +def take_2d_multi_float32_float32(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 288 | +def take_2d_multi_float32_float64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 289 | +def take_2d_multi_float64_float64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 290 | +def take_2d_multi_object_object(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 291 | +def take_2d_multi_bool_bool(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 292 | +def take_2d_multi_bool_object(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
| 293 | +def take_2d_multi_int64_int64(values: np.ndarray, indexer, out: np.ndarray, fill_value=...) -> None: ... |
0 commit comments