CutePandas: dataframe models and widgets for Qt
CutePandas provides Qt item models, delegates and ready-made widgets for showing dataframes in Qt applications. pandas is the first-class backend (incl. MultiIndex rows / columns and pyarrow-backed dtypes); the table, schema and category models also show pyarrow Tables and polars DataFrames. It is built on prettyqt and works with PySide6 or PyQt6.
Documentation: https://phil65.github.io/cutepandas/
Installation
A Qt binding is required, pick one via an extra:
pip install "cutepandas[pyside6]"
# or
pip install "cutepandas[pyqt6]"
# polars support (optional)
pip install "cutepandas[pyside6,polars]"
Quickstart
import pandas as pd
from prettyqt import widgets
from cutepandas import delegates, pandasmodels, pandaswidgets
app = widgets.app()
df = pd.DataFrame({"name": ["apple", "banana", "cherry"], "price": [1.2, 0.5, 3.0]})
# Composite viewer: data table plus synced row/column headers (MultiIndex aware)
viewer = pandaswidgets.DataFrameViewer(df)
viewer.show()
# Or use the models directly with any view, here with a fast string filter
model = pandasmodels.DataFrameModel(df, color_values=True)
proxy = pandasmodels.PandasStringColumnFilterProxyModel()
proxy.setSourceModel(model)
proxy.set_filter_column(0)
proxy.set_search_term("b") # rows whose "name" starts with "b"
table = widgets.TableView()
table.set_model(proxy)
table.set_delegate(delegates.ValueColorDelegate(mode="bar"), column=1)
table.show()
app.exec()
Backends: FrameSource
DataFrameModel never touches a frame directly. It reads through a FrameSource
(cutepandas.frames, Qt-free), a small protocol with adapters for pandas
(PandasSource), pyarrow (ArrowSource) and polars (PolarsSource, imported only when
a polars frame is passed):
| Member | Purpose |
|---|---|
backend, native |
backend name, the wrapped frame |
row_count, columns |
shape; ColumnInfo(name, dtype, kind, native_dtype) per column |
fetch(start, stop, columns) |
a window as Python values (ColumnChunk: values + null mask) |
fetch_arrow(start, stop, columns) |
the same window as a pyarrow.Table |
null_count, nbytes, value_range, value_counts, categories, describe |
column metadata and statistics |
sort(column, descending) (optional, SortableSource) |
a sorted copy (stable, nulls last) |
argsort(column, descending), fetch_rows(rows, columns) (optional, PermutableSource) |
sort order as row positions; a window in any row order |
set_value(row, column, value) (optional, EditableSource) |
in-place cell edit |
Kind groups the backend dtypes (integer, float, string, categorical, datetime, ...) and
drives formatting, alignment and icons. Anything that implements the protocol (e.g. a
lazy source of an application) can be passed to the models instead of a frame.
import polars as pl
from cutepandas import frames, pandasmodels
source = frames.as_source(pl.DataFrame({"a": [1, 2, None]}))
source.fetch(0, 2, [0])[0].values # [1, 2]
model = pandasmodels.DataFrameModel(source)
Windowed model
DataFrameModel fetches rows in blocks (chunk_rows, default 256) per column, formats
each block once with per-dtype formatters (FormatOptions: float precision, thousands
separator, null text, text truncation) and keeps at most max_chunks blocks (default
256) in an LRU ChunkCache. Only the visible window is ever converted to Python
objects, so memory is the frame plus a small, bounded cache. Background colours
(color_values=True) and normalised values (NormalizedRole, used by
ValueColorDelegate) are computed per block with NumPy, not per data() call.
Measured on a 10M-row x 10-column frame (4 float, 2 int, datetime, categorical,
unique strings, bool; about 700 MB), four roles of every cell of a 40 x 10 viewport at
random positions, cold cache: median 4.5 ms, p95 8 ms, max 11 ms for pandas, pyarrow
and polars alike. The full cache (256 blocks) adds about 9 MB. With color_values, the
first paint scans each numeric column once for its range (0.04-0.4 s on 10M rows).
Sorting
A header click in DataFrameViewer emits sort_requested(column, order) (a
Qt.SortOrder; the same column again reverses). What happens next:
sortable=False: nothing else. The application sorts under its own control (e.g. within a memory budget, or as a step of a pipeline), shows the result withset_df()and restores the indicator withset_sort_state(column, order).sortable=True(default) andsort_mode="copy"(default): the source builds a sorted copy (SortableSource.sort) that replaces the frame, as large as the frame itself.sortable=Trueandsort_mode="permutation": a display-only sort. The source computes the order as row positions (PermutableSource.argsort; 8 bytes per row), stored asDataFrameHolder.row_order; the frame is neither copied nor changed and every visible block is read through the order (fetch_rows). The order is computed in a worker thread (sorting_changed(True / False)); only the latest request is applied, only if the frame was not replaced or edited meanwhile, andcancel_sort()drops a running one. Replacing the frame orclear_sort()restores the frame's order; row labels follow the order (MultiIndex spans are off while sorted).
The building blocks are public: DataFrameModel.compute_sort_permutation(column, order) (any thread) returns a SortPermutation, apply_sort_permutation() (GUI
thread) applies it or returns False if it is stale, source_row(row) maps a model row
to a frame row. Sort orders are stable with nulls last; pandas uses NumPy's stable
argsort for NumPy dtypes and Arrow's sort kernel for Arrow-backed columns (incl. the
pandas 3 str dtype), pyarrow Arrow's sort kernel, polars its own (multi-threaded)
sort.
Measured on 10M rows (one column sorted, descending): computing the order takes 1.6 s (int) / 2.1 s (float) / 6.1 s (str) for pandas, 1.8 / 2.2 / 4.9 s for pyarrow and 0.35 / 0.33 / 1.3 s for polars; the order takes 80 MB. A cold 60 x 3 viewport read through it: median 0.8-1.2 ms, max 3.3 ms on every backend.
Translations
cutepandas ships English labels only. SchemaModel, PandasColumnListModel,
PandasIndexListModel, CategoryModel, TopValuesModel, ColumnProfileWidget and
DataFrameWidget take translate= (a str -> str callable such as a gettext
function) and look each label up when they show it; set_translate() swaps it and
retranslate() re-shows the labels after a language switch. The English labels are
marked with cutepandas.utils.i18n.N_, so xgettext --keyword=N_ (or babel
-k N_) extracts them for a catalog.
Threads
- GUI thread only: every Qt method of the models (
data,setData,sort, assigningdf, the setters),DataFrameHolder, all widgets,ColumnProfileWidget.set_stats. - Any thread:
DataFrameModel.compute_sort_permutation,DataFrameModel.prefetch(first_row, last_row, columns)(fills the cache, e.g. ahead of scrolling), theChunkCache(all mutations under a lock;clear()/invalidate()start a new generation so a block built from old data is dropped) and the read methods of aFrameSource(fetch,describe, ...; e.g. compute column statistics in a worker and hand them toColumnProfileWidget.set_stats). set_valueedits the frame in place: don't run it while a worker reads the frame.
There is no module-level mutable state.
Features
- Models:
DataFrameModel(any backend; MultiIndex levels joined by a configurable separator),VerticalHeaderModel/HorizontalHeaderModel(one cell per index level),SchemaModel(columns with dtype, icon, null count, size) andCategoryModel(categories with code and count; pandascategory, polarsEnum/Categorical, Arrow dictionaries). The pandas modelsPandasColumnListModel,PandasCategoryListModelandPandasIndexListModelalso edit the frame. - Filter proxies (pandas) that filter with NumPy boolean indexes instead of
per-cell Python calls, which is much faster than
QSortFilterProxyModelon large frames:PandasStringColumnFilterProxyModel,PandasMultiStringColumnFilterProxyModel,PandasEvalFilterProxyModel(filter with aDataFrame.evalexpression). - Delegates:
DTypeDelegate(pick a dtype from a combo box with dtype icons),ValueColorDelegate(data bar or heat map fromNormalizedRole). - Widgets:
DataFrameViewer(data and header tables kept in sync, spans for MultiIndex),ColumnProfileWidget(dtype, counts, min / max / mean / std, top values with share bars),DataFrameWidget(viewer with docks for index, columns, categories, column profile anddf.attrs),DataFrameListWidgetandDataFrameManagerWidgetfor several DataFrames. - Icons:
cutepandas.utils.icons.icon_for_dtype/icon_for_kindfor pandas, pyarrow and polars dtypes.
Development
uv sync --all-extras
uv run pytest
uv run ruff check . && uv run ty check
License
Metadata
Release files for cutepandas 0.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| cutepandas-0.6.1.tar.gz | 57.2 kB | With provenance | Details for cutepandas-0.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cutepandas-0.6.1-py3-none-any.whl | Python 3 | none | any | Details for cutepandas-0.6.1-py3-none-any.whl |
Total release size: 128.1 kB
Release files / cutepandas-0.6.1.tar.gz
| Download URL | cutepandas-0.6.1.tar.gz |
|---|---|
| Size | 57.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
607dc76b43adc3d5cd506ff739dc39141a0909c851f05af788547110b10853e5
|
|
BLAKE2b-256 checksum How to use checksums |
ccab618b4a703d91d9efc5bfd824fee1afb2df67be30dded82d414c5fa6c2123
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logRelease files / cutepandas-0.6.1-py3-none-any.whl
| Download URL | cutepandas-0.6.1-py3-none-any.whl |
|---|---|
| Size | 70.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d32514855ea3e36db705e73656096d2f35f4730b4a7fcf3d88606630eb6a9ff
|
|
BLAKE2b-256 checksum How to use checksums |
e83a3612554a1d0f1e7b70b00636511290666bd7aedc47223082c229b3d6f720
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logSecurity for cutepandas 0.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for cutepandas-0.6.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.