Using Dataspell’s Interactive DataFrame Viewer in Notebooks
Dataspell’s built‑in DataFrame viewer lets you sort, filter, and inspect pandas tables directly in notebook output, with caveats for large data and styling.
05 Sept 2025, 14:04 UTC

Quick answer: view and manipulate DataFrames directly
When a pandas DataFrame is the last expression in a Dataspell notebook cell, the IDE automatically renders an interactive grid below the output. This lets you sort columns, filter rows, and see a quick plot without writing print(df.head()) or opening an external tool.
How the viewer works – a worked example
First, ensure you have the Pandas plugin enabled (it is bundled with Dataspell). Then run the following code in a notebook cell:
import pandas as pd
import numpy as np
# Create a small sample DataFrame
df = pd.DataFrame({
'city': ['New York', 'Los Angeles', 'San Francisco', 'Chicago'],
'population_millions': [8.4, 3.9, 0.9, 2.7]
})
df # last expression triggers the viewer
The cell finishes, and Dataspell intercepts the df object. Its built‑in grid component renders a spreadsheet‑like table:
- Clicking the population_millions header sorts ascending; click again for descending.
- Typing a value in the filter box above a column shows only rows that match the predicate (e.g., enter
>4to see cities with more than 4 million inhabitants). - Hovering over a row reveals a tooltip with the exact values.
If you prefer to trigger the viewer explicitly, you can call the helper function ds.show(df) (available after importing the dataspell helper module) or open the Variable Explorer pane, locate df, and click the eye icon.
Limits and common mistakes
Large frames are downsampled. When a DataFrame exceeds roughly 100 k rows, Dataspell shows a preview and displays a footer message like “Showing 100 000 of 1 200 000 rows”. The full data is not loaded into the viewer, so sorting or filtering only applies to the preview. To verify, run:
big_df = pd.DataFrame(np.random.rand(150000, 2))
big_df # observe the downsample notice in the viewer footer
If you need to work with the full set, limit the DataFrame first (e.g., big_df.head(50)) or use external tools.
Styling and custom __repr__ are ignored. The viewer bypasses pandas’ _repr_html_ and any style.apply calls; you will see the raw values only. Apply styling after you have inspected the data, or export to HTML if visual formatting is required.
Viewer does not auto‑refresh. If you mutate the DataFrame after the grid appears (e.g., df.loc[0, 'population_millions'] = 9.0) and re‑run the same cell without changing the last expression, the displayed grid stays unchanged. To see updates, either re‑execute the cell or call ds.show(df) again.
Polars frames need a plugin. The built‑in viewer understands pandas objects only. For Polars DataFrame instances, install the optional Polars plugin from the Dapsell marketplace; otherwise the variable will appear as a generic object.
Practical verification steps
- Open a new Dataspell notebook.
- Paste the small‑sample code block above and run the cell.
- Confirm that a sortable grid appears below the cell.
- Click a column header to sort and verify the row order changes.
- Type a filter condition (e.g.,
>4in the population box) and confirm only matching rows remain. - Run the large‑frame snippet and look for the downsample notice in the viewer footer.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.