sparse.pyi 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. from typing import Sequence
  2. import numpy as np
  3. from pandas._typing import (
  4. Self,
  5. npt,
  6. )
  7. class SparseIndex:
  8. length: int
  9. npoints: int
  10. def __init__(self) -> None: ...
  11. @property
  12. def ngaps(self) -> int: ...
  13. @property
  14. def nbytes(self) -> int: ...
  15. @property
  16. def indices(self) -> npt.NDArray[np.int32]: ...
  17. def equals(self, other) -> bool: ...
  18. def lookup(self, index: int) -> np.int32: ...
  19. def lookup_array(self, indexer: npt.NDArray[np.int32]) -> npt.NDArray[np.int32]: ...
  20. def to_int_index(self) -> IntIndex: ...
  21. def to_block_index(self) -> BlockIndex: ...
  22. def intersect(self, y_: SparseIndex) -> Self: ...
  23. def make_union(self, y_: SparseIndex) -> Self: ...
  24. class IntIndex(SparseIndex):
  25. indices: npt.NDArray[np.int32]
  26. def __init__(
  27. self, length: int, indices: Sequence[int], check_integrity: bool = ...
  28. ) -> None: ...
  29. class BlockIndex(SparseIndex):
  30. nblocks: int
  31. blocs: np.ndarray
  32. blengths: np.ndarray
  33. def __init__(
  34. self, length: int, blocs: np.ndarray, blengths: np.ndarray
  35. ) -> None: ...
  36. # Override to have correct parameters
  37. def intersect(self, other: SparseIndex) -> Self: ...
  38. def make_union(self, y: SparseIndex) -> Self: ...
  39. def make_mask_object_ndarray(
  40. arr: npt.NDArray[np.object_], fill_value
  41. ) -> npt.NDArray[np.bool_]: ...
  42. def get_blocks(
  43. indices: npt.NDArray[np.int32],
  44. ) -> tuple[npt.NDArray[np.int32], npt.NDArray[np.int32]]: ...