diff --git a/pandas/_libs/hashing.pyi b/pandas/_libs/hashing.pyi new file mode 100644 index 0000000000000..2844ec9b06557 --- /dev/null +++ b/pandas/_libs/hashing.pyi @@ -0,0 +1,7 @@ +import numpy as np + +def hash_object_array( + arr: np.ndarray, # np.ndarray[object] + key: str, + encoding: str = ..., +) -> np.ndarray: ... # np.ndarray[np.uint64] diff --git a/pandas/_libs/ops.pyi b/pandas/_libs/ops.pyi new file mode 100644 index 0000000000000..b4f42f217a5db --- /dev/null +++ b/pandas/_libs/ops.pyi @@ -0,0 +1,43 @@ +from typing import ( + Any, + Callable, +) + +import numpy as np + +_BinOp = Callable[[Any, Any], Any] +_BoolOp = Callable[[Any, Any], bool] + + +def scalar_compare( + values: np.ndarray, # object[:] + val: object, + op: _BoolOp, # {operator.eq, operator.ne, ...} +) -> np.ndarray: ... # np.ndarray[bool] + +def vec_compare( + left: np.ndarray, # np.ndarray[object] + right: np.ndarray, # np.ndarray[object] + op: _BoolOp, # {operator.eq, operator.ne, ...} +) -> np.ndarray: ... # np.ndarray[bool] + + +def scalar_binop( + values: np.ndarray, # object[:] + val: object, + op: _BinOp, # binary operator +) -> np.ndarray: ... + + +def vec_binop( + left: np.ndarray, # object[:] + right: np.ndarray, # object[:] + op: _BinOp, # binary operator +) -> np.ndarray: ... + + +def maybe_convert_bool( + arr: np.ndarray, # np.ndarray[object] + true_values=..., + false_values=... +) -> np.ndarray: ... diff --git a/pandas/_libs/ops_dispatch.pyi b/pandas/_libs/ops_dispatch.pyi new file mode 100644 index 0000000000000..91b5a4dbaaebc --- /dev/null +++ b/pandas/_libs/ops_dispatch.pyi @@ -0,0 +1,5 @@ +import numpy as np + +def maybe_dispatch_ufunc_to_dunder_op( + self, ufunc: np.ufunc, method: str, *inputs, **kwargs +): ... diff --git a/pandas/_libs/reshape.pyi b/pandas/_libs/reshape.pyi new file mode 100644 index 0000000000000..7aaa18a7feff2 --- /dev/null +++ b/pandas/_libs/reshape.pyi @@ -0,0 +1,19 @@ +import numpy as np + +def unstack( + values: np.ndarray, # reshape_t[:, :] + mask: np.ndarray, # const uint8_t[:] + stride: int, + length: int, + width: int, + new_values: np.ndarray, # reshape_t[:, :] + new_mask: np.ndarray, # uint8_t[:, :] +) -> None: ... + + +def explode( + values: np.ndarray, # np.ndarray[object] +) -> tuple[ + np.ndarray, # np.ndarray[object] + np.ndarray, # np.ndarray[np.int64] +]: ...