dataframeholder
Class info¶
Classes¶
| Name | Children | Inherits |
|---|---|---|
| DataFrameHolder cutepandas.pandasmodels.dataframeholder Holds the current frame for several models / widgets (GUI thread only). |
||
| DataFrameHolderMixin cutepandas.pandasmodels.dataframeholder Model mixin: keeps `self.df` in a (possibly shared) DataFrameHolder. |
🛈 DocStrings¶
A shared, observable container for one frame (pandas, polars, pyarrow).
DataFrameHolder
¶
Bases: Object
Holds the current frame for several models / widgets (GUI thread only).
Frame operations like rename or astype return a new frame instead of changing
the old one. Models that share a holder always see the current frame: replacing it
emits about_to_change and changed, and every model except the one that made the
change (the origin) resets itself.
Accepts a pandas DataFrame / Series (a Series is stored as a one-column frame), a
pyarrow Table, a polars DataFrame or any FrameSource. df is the native frame,
source the backend-agnostic adapter the table models read through.
row_order is an optional display order (row positions, see set_row_order):
a sort that only changes what the views show, without copying the frame.
Replacing the frame clears it.
Source code in src/cutepandas/pandasmodels/dataframeholder.py
df
property
writable
¶
The native frame (pandas DataFrame, pyarrow Table, polars DataFrame).
row_order
property
¶
Display order of the rows (row positions), None for the frame's order.
set_df
¶
Replace the frame. origin is passed on with the signals.
set_row_order
¶
Show the rows in another order without touching the frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
order
|
Any
|
One row position per row (a permutation, e.g. from
|
required |
origin
|
Any
|
Passed on with the signals. |
None
|
Source code in src/cutepandas/pandasmodels/dataframeholder.py
DataFrameHolderMixin
¶
Model mixin: keeps self.df in a (possibly shared) DataFrameHolder.
Call _init_holder from __init__ after the Qt base class is initialized.
Assigning self.df replaces the holder's frame; the model itself is then expected
to emit the matching signals (e.g. inside change_layout()), while all other
models of the holder are reset.