frames
Class info¶
Re-exported classes¶
| Class | Module | Description |
|---|---|---|
| ArrowSource | cutepandas.frames.arrowsource | Read-only source over a pyarrow.Table (or RecordBatch). |
| ChunkCache | cutepandas.frames.chunkcache | Caches converted windows of a frame, keyed by (row block, column). |
| ColumnChunk | cutepandas.frames.source | A window of one column as Python values. |
| ColumnInfo | cutepandas.frames.source | Name and dtype of one column. |
| ColumnStats | cutepandas.frames.source | Basic statistics of one column (see FrameSource.describe). |
| EditableSource | cutepandas.frames.source | Optional hook: a source whose frame can be changed cell by cell (GUI thread). |
| FormatOptions | cutepandas.frames.formatters | How cell values are turned into display text. |
| FrameSource | cutepandas.frames.source | Read access to a rectangular frame, independent of the backend. |
| Kind | cutepandas.frames.source | Backend-independent family of a column dtype (drives formatting and icons). |
| PandasSource | cutepandas.frames.pandassource | Source over a pandas DataFrame (a Series is shown as a one-column frame). |
| PermutableSource | cutepandas.frames.source | Optional hook: sort order as row positions, and reads in any row order. |
| SortableSource | cutepandas.frames.source | Optional hook: a source that can return a sorted copy of its frame. |
🛈 DocStrings¶
Backend-agnostic, Qt-free access to dataframes.
FrameSource is the protocol the Qt models of cutepandas are built on. as_source
wraps a pandas DataFrame / Series, a pyarrow Table / RecordBatch or a polars DataFrame
(polars is only imported when a polars frame is passed). Objects that already follow
the protocol (e.g. a lazy source of an application) are returned unchanged.
ArrowSource
¶
Read-only source over a pyarrow.Table (or RecordBatch).
Implements the optional SortableSource and PermutableSource hooks.
Source code in src/cutepandas/frames/arrowsource.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
ChunkCache
¶
Caches converted windows of a frame, keyed by (row block, column).
A row block covers chunk_rows consecutive rows of one column, so a wide frame only
converts the visible columns. At most max_chunks blocks are kept; the least
recently used one is dropped first, so memory stays bounded however far the user
scrolls.
Every mutation happens under a lock, so a worker thread may fill the cache
(get_or_build) while the GUI thread reads it. clear() and invalidate() start a
new generation: a block built from the old data by a slow worker is dropped instead
of stored.
Source code in src/cutepandas/frames/chunkcache.py
block_bounds
¶
Row range (start, stop) of a block, clipped to row_count.
clear
¶
get_or_build
¶
Return the cached block or build it (outside the lock) and store it.
Source code in src/cutepandas/frames/chunkcache.py
invalidate
¶
Drop the blocks of one row block and/or column (all if both are None).
Source code in src/cutepandas/frames/chunkcache.py
put
¶
Store a block; returns False if it was built for an older generation.
Source code in src/cutepandas/frames/chunkcache.py
ColumnChunk
dataclass
¶
A window of one column as Python values.
Source code in src/cutepandas/frames/source.py
ColumnInfo
dataclass
¶
Name and dtype of one column.
Source code in src/cutepandas/frames/source.py
ColumnStats
dataclass
¶
Basic statistics of one column (see FrameSource.describe).
Source code in src/cutepandas/frames/source.py
top
class-attribute
instance-attribute
¶
Most frequent non-null values with their counts, most frequent first.
EditableSource
¶
Bases: Protocol
Optional hook: a source whose frame can be changed cell by cell (GUI thread).
Source code in src/cutepandas/frames/source.py
set_value
¶
FormatOptions
dataclass
¶
How cell values are turned into display text.
Source code in src/cutepandas/frames/formatters.py
float_precision
class-attribute
instance-attribute
¶
Significant digits for floats ({:.6g}, whole numbers keep a .0).
max_text_length
class-attribute
instance-attribute
¶
Longer texts are cut and end with an ellipsis (the tooltip shows all).
thousands_separator
class-attribute
instance-attribute
¶
Group digits of integers and floats (1,234,567).
FrameSource
¶
Bases: Protocol
Read access to a rectangular frame, independent of the backend.
Source code in src/cutepandas/frames/source.py
categories
¶
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.
fetch
¶
fetch(start: int, stop: int, columns: Sequence[int]) -> list[ColumnChunk]
fetch_arrow
¶
nbytes
¶
value_counts
¶
value_range
¶
Kind
¶
Bases: StrEnum
Backend-independent family of a column dtype (drives formatting and icons).
Source code in src/cutepandas/frames/source.py
PandasSource
¶
Source over a pandas DataFrame (a Series is shown as a one-column frame).
Supports every pandas dtype, incl. pyarrow-backed ones (string[pyarrow],
pd.ArrowDtype). Implements the optional SortableSource, PermutableSource and
EditableSource hooks: set_value writes in place (DataFrame.iat).
Source code in src/cutepandas/frames/pandassource.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |
PermutableSource
¶
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
argsort
¶
fetch_rows
¶
fetch_rows(rows: ndarray, columns: Sequence[int]) -> list[ColumnChunk]
SortableSource
¶
Bases: Protocol
Optional hook: a source that can return a sorted copy of its frame.
Source code in src/cutepandas/frames/source.py
sort
¶
as_source
¶
as_source(obj: Any) -> FrameSource
Wrap a supported frame in its FrameSource adapter.
Source code in src/cutepandas/frames/__init__.py
format_chunk
¶
Format a chunk of values; missing values become null_text.
Source code in src/cutepandas/frames/formatters.py
format_name
¶
Column label as text; tuples (pandas MultiIndex columns) are joined.
formatter_for
¶
formatter_for(kind: Kind, options: FormatOptions) -> Formatter
Return a function that formats one non-null value of the given kind.
Source code in src/cutepandas/frames/formatters.py
is_polars_frame
¶
True for a polars DataFrame, without importing polars.
kind_for_arrow_type
¶
kind_for_arrow_type(typ: DataType) -> Kind
Map an Arrow type to a Kind.
Source code in src/cutepandas/frames/arrowsource.py
kind_for_pandas_dtype
¶
kind_for_pandas_dtype(dtype: Any) -> Kind
Map a pandas / NumPy dtype (incl. pd.ArrowDtype, or its name) to a Kind.