Skip to content

PermutableSource

Base classes

Name Children Inherits
Protocol
typing
Base class for protocol classes.

⋔ Inheritance diagram

graph TD
  3052484967["source.PermutableSource"]
  1073422405["typing.Protocol"]
  3481597255["typing.Generic"]
  2751680898["builtins.object"]
  1073422405 --> 3052484967
  3481597255 --> 1073422405
  2751680898 --> 3481597255

🛈 DocStrings

Bases: Protocol

Optional hook: sort order as row positions, and reads in any row order.

Used for a display-only sort: the model keeps the permutation (one integer per row) and reads each visible window through it, so the frame is never copied.

Source code in src/cutepandas/frames/source.py
@runtime_checkable
class PermutableSource(Protocol):
    """Optional hook: sort order as row positions, and reads in any row order.

    Used for a display-only sort: the model keeps the permutation (one integer per
    row) and reads each visible window through it, so the frame is never copied.
    """

    def argsort(self, column: int, descending: bool = False) -> np.ndarray:
        """Row positions that sort the frame stably by one column, nulls last."""
        ...

    def fetch_rows(self, rows: np.ndarray, columns: Sequence[int]) -> list[ColumnChunk]:
        """The given row positions (in that order) of the given columns."""
        ...

argsort

argsort(column: int, descending: bool = False) -> ndarray

Row positions that sort the frame stably by one column, nulls last.

Source code in src/cutepandas/frames/source.py
def argsort(self, column: int, descending: bool = False) -> np.ndarray:
    """Row positions that sort the frame stably by one column, nulls last."""
    ...

fetch_rows

fetch_rows(rows: ndarray, columns: Sequence[int]) -> list[ColumnChunk]

The given row positions (in that order) of the given columns.

Source code in src/cutepandas/frames/source.py
def fetch_rows(self, rows: np.ndarray, columns: Sequence[int]) -> list[ColumnChunk]:
    """The given row positions (in that order) of the given columns."""
    ...

:fa-brands-github: Show source on GitHub