Inspecting Pandas DataFrames in Dataspell Without Leaving the Debugger
Dataspell's built-in DataFrame viewer lets you sort, filter, and export pandas DataFrames directly in the debugger—no print statements, no CSV round-trips. Here's how to use it, where it struggles with large frames, and a quick verification checklist.
30 Sept 2025, 23:12 UTC

The problem: context switching kills flow
You're debugging a data pipeline. A DataFrame looks off—maybe a column shifted, maybe nulls crept in. The usual routine: print the head, write a temporary CSV, open it in a spreadsheet, scroll, filter, realize you need a different slice, repeat. Each hop between IDE, terminal, and external tool breaks concentration and litters the repo with throwaway files.
Dataspell's interactive DataFrame viewer keeps that inspection inside the debugger. When a pandas DataFrame is in scope, a table icon appears next to the variable in the Variables pane. Clicking it opens a sortable, filterable tab with the first 100 rows, column types, and inline search. You can spot schema drift, outliers, or missing values without a single print() or to_csv().
What the viewer actually shows
The viewer renders the in-memory DataFrame as a grid. Column headers display the dtype (int64, object, float64, etc.), and rows are numbered from the DataFrame's index. You can:
- Click a header to sort ascending or descending.
- Type in the search box to filter rows across all columns (substring match).
- Drag columns to reorder them.
- Select a rectangular range and copy it to the clipboard (tab-separated, ready for a spreadsheet).
- Export the current view—filtered, sorted, or full—to a CSV file via the toolbar button.
All of this works on the live object in the debug session. No serialization round-trip, no extra code.
Worked example: catching a dtype mismatch
Suppose you're merging two DataFrames on a key column. The merge returns empty, but both frames look like they have the same IDs. Set a breakpoint after both frames are loaded and before the merge. In the Variables pane you see df_left and df_right. Click the table icon on each.
# In a Dataspell Python file
import pandas as pd
df_left = pd.DataFrame({
'user_id': [1, 2, 3],
'score': [10.5, 20.0, 30.2]
})
df_right = pd.DataFrame({
'user_id': ['1', '2', '3'], # strings, not ints
'tier': ['gold', 'silver', 'bronze']
})
# breakpoint here
merged = df_left.merge(df_right, on='user_id')
In the viewer, df_left.user_id shows int64 while df_right.user_id shows object. The filter box on df_right reveals the values are quoted strings. Fix: df_right['user_id'] = df_right['user_id'].astype(int) before the merge. The viewer turned a silent logical bug into a visible dtype difference in seconds.
Where it falls short
The viewer loads the entire DataFrame into the UI's memory. With frames above a few hundred thousand rows, opening the tab can freeze the IDE for noticeable seconds and spike heap usage. The viewer also only works on in-memory pandas objects—no lazy loading from SQL, Parquet, or Dask. If your data lives outside pandas, you must materialize a sample first.
Practical guardrails:
- Call
df.head(1000)ordf.sample(5000, random_state=42)and inspect the result instead of the full frame. - For wide DataFrames, select only the columns you need:
df[['col_a', 'col_b']]. - If the viewer feels sluggish, close the tab; it releases the UI-side copy immediately.
Verify it works in your project
- Open any Python file in Dataspell 2024.2 or later.
- Create a small DataFrame and set a breakpoint after it.
- Run the file in debug mode (Shift+F9 on Windows/Linux, Ctrl+D on macOS).
- When paused, open the Variables tool window (Alt+5 on Windows/Linux, Cmd+5 on macOS).
- Find the DataFrame variable; a small table icon appears next to its name. Click it.
- Confirm a new tab opens with sortable headers, a search box, and the export button.
If the icon is missing, ensure the configured Python interpreter has pandas installed and the variable type is recognized as pandas.core.frame.DataFrame.
Closing thought
The DataFrame viewer doesn't replace profiling tools or comprehensive EDA notebooks. It replaces the five-minute context switch when you just need to answer "does this column look right?" Keep a breakpoint handy, click the icon, and stay in the flow.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.