Skip to content

FrameSource

Base classes

Name Children Inherits
Protocol
typing
Base class for protocol classes.

⋔ Inheritance diagram

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

🛈 DocStrings

Bases: Protocol

Read access to a rectangular frame, independent of the backend.

Source code in src/cutepandas/frames/source.py
@runtime_checkable
class FrameSource(Protocol):
    """Read access to a rectangular frame, independent of the backend."""

    backend: str
    """Short backend name: `pandas`, `pyarrow` or `polars`."""

    @property
    def native(self) -> Any:
        """The wrapped backend frame."""
        ...

    @property
    def row_count(self) -> int: ...

    @property
    def columns(self) -> Sequence[ColumnInfo]: ...

    def fetch(self, start: int, stop: int, columns: Sequence[int]) -> list[ColumnChunk]:
        """Rows `start:stop` of the given column positions as Python values."""
        ...

    def fetch_arrow(self, start: int, stop: int, columns: Sequence[int]) -> pa.Table:
        """Rows `start:stop` of the given column positions as an Arrow table."""
        ...

    def null_count(self, column: int) -> int: ...

    def nbytes(self, column: int) -> int:
        """Memory used by the column's buffers (backend estimate)."""
        ...

    def value_range(self, column: int) -> tuple[float, float] | None:
        """(min, max) of a numeric or boolean column, None for other kinds / no data."""
        ...

    def value_counts(
        self, column: int, limit: int | None = None
    ) -> list[tuple[Any, int]]:
        """Non-null values with their counts, most frequent first."""
        ...

    def categories(self, column: int) -> list[Any] | None:
        """Categories of a categorical / enum / dictionary column, else None."""
        ...

    def describe(self, column: int, top: int = 10) -> ColumnStats:
        """Basic statistics of one column.

        Scans the whole column: call it off the GUI thread for large frames.
        """
        ...

backend instance-attribute

backend: str

Short backend name: pandas, pyarrow or polars.

native property

native: Any

The wrapped backend frame.

categories

categories(column: int) -> list[Any] | None

Categories of a categorical / enum / dictionary column, else None.

Source code in src/cutepandas/frames/source.py
def categories(self, column: int) -> list[Any] | None:
    """Categories of a categorical / enum / dictionary column, else None."""
    ...

describe

describe(column: int, top: int = 10) -> ColumnStats

Basic statistics of one column.

Scans the whole column: call it off the GUI thread for large frames.

Source code in src/cutepandas/frames/source.py
def describe(self, column: int, top: int = 10) -> ColumnStats:
    """Basic statistics of one column.

    Scans the whole column: call it off the GUI thread for large frames.
    """
    ...

fetch

fetch(start: int, stop: int, columns: Sequence[int]) -> list[ColumnChunk]

Rows start:stop of the given column positions as Python values.

Source code in src/cutepandas/frames/source.py
def fetch(self, start: int, stop: int, columns: Sequence[int]) -> list[ColumnChunk]:
    """Rows `start:stop` of the given column positions as Python values."""
    ...

fetch_arrow

fetch_arrow(start: int, stop: int, columns: Sequence[int]) -> Table

Rows start:stop of the given column positions as an Arrow table.

Source code in src/cutepandas/frames/source.py
def fetch_arrow(self, start: int, stop: int, columns: Sequence[int]) -> pa.Table:
    """Rows `start:stop` of the given column positions as an Arrow table."""
    ...

nbytes

nbytes(column: int) -> int

Memory used by the column's buffers (backend estimate).

Source code in src/cutepandas/frames/source.py
def nbytes(self, column: int) -> int:
    """Memory used by the column's buffers (backend estimate)."""
    ...

value_counts

value_counts(column: int, limit: int | None = None) -> list[tuple[Any, int]]

Non-null values with their counts, most frequent first.

Source code in src/cutepandas/frames/source.py
def value_counts(
    self, column: int, limit: int | None = None
) -> list[tuple[Any, int]]:
    """Non-null values with their counts, most frequent first."""
    ...

value_range

value_range(column: int) -> tuple[float, float] | None

(min, max) of a numeric or boolean column, None for other kinds / no data.

Source code in src/cutepandas/frames/source.py
def value_range(self, column: int) -> tuple[float, float] | None:
    """(min, max) of a numeric or boolean column, None for other kinds / no data."""
    ...

:fa-brands-github: Show source on GitHub