frames
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| Column datacook.engine.frames Column(name: str, dtype: str) |
||
| FrameSummary datacook.engine.frames What views need without holding a frame: shape, schema, memory. |
🛈 DocStrings¶
The narrow engine interface to the dataframe library.
Everything outside ops/ and formats that needs to look at a frame goes through these
functions, so the dataframe library can be swapped per op later.
Today the only backend is pandas 3 (copy-on-write, pyarrow-backed dtypes). An op declares
its backend (Op.backend); ensure_backend() is the conversion point when a second one
(polars) arrives.
FrameSummary
dataclass
¶
What views need without holding a frame: shape, schema, memory.
Source code in src/datacook/engine/frames.py
buffers
¶
Memory buffers of a frame, {key: nbytes}.
Frames that share data (copy-on-write: rename, column subset, ...) return the same keys for the shared buffers, so a cache can count shared memory once.
Source code in src/datacook/engine/frames.py
ensure_backend
¶
Convert frame to the frame type of backend (identity while pandas is the only one).
Source code in src/datacook/engine/frames.py
nbytes
¶
summary
¶
summary(frame: Frame, buffers_: dict[int, int] | None = None) -> FrameSummary
Shape, schema and size; pass buffers(frame) if already measured.
Source code in src/datacook/engine/frames.py
to_arrow_dtypes
¶
Convert numpy / object columns to pyarrow-backed dtypes (no-op for arrow columns).
Source code in src/datacook/engine/frames.py
window
¶
Rows start:stop (and optionally a column subset); a view under copy-on-write.