Running a Jupyter Notebook Cell and Inspecting a DataFrame in JetBrains Dataspell
Learn how to run a Jupyter notebook cell that loads a pandas DataFrame in JetBrains Dataspell, then inspect the data using the Variable Explorer, DataFrame viewer, and inline plotting features.
12 Jul 2026, 18:03 UTC

Desired outcome
You want to execute a code cell in a Jupyter notebook that loads a dataset into a pandas DataFrame, then immediately view and explore that DataFrame inside Dataspell’s Variable Explorer and DataFrame viewer, optionally rendering an inline plot.
Prerequisites
- JetBrains Dataspell 2024.3 or later installed.
- A Python interpreter (or conda environment) with
pandasandmatplotlib(orseaborn) available. - A notebook file (
.ipynb) either newly created or existing in your project. - Read access to the data file you intend to load (e.g., a CSV).
Procedure
- Open or create the notebook
In the Project view, double‑click a
.ipynbfile to open it in the editor. - Attach a Python kernel
Locate the kernel selector in the top‑right corner of the notebook toolbar (shows the current kernel name). Click it and choose the Python interpreter or conda environment that contains the required packages. If the environment is not listed, click Add Kernel and point to the interpreter’s executable.
- Write the code to load the data
In the first cell, type or paste the following example, replacing
<path/to/data.csv>with the actual file path:import pandas as pd import matplotlib.pyplot as plt # Load dataset df = pd.read_csv('<path/to/data.csv>') # Quick sanity check: show first 5 rows print(df.head()) # Example inline plot plt.figure(figsize=(6,4)) df.iloc[:,0].hist(bins=30) plt.title('Distribution of first column') plt.xlabel(df.columns[0]) plt.ylabel('Frequency') plt.show() - Execute the cell
Press Shift+Enter or click the run icon (▶) left of the cell. Dataspell will send the code to the attached kernel.
- Verify kernel execution
After execution, look at the cell’s output area. You should see the printed
df.head()table and, below it, the matplotlib figure rendered inline. - Inspect the DataFrame in the Variable Explorer
Open the Variable Explorer pane (usually on the left or bottom). The newly created variable
dfappears with its type (DataFrame) and shape. Click the variable name to launch the DataFrame viewer. - Explore the DataFrame viewer
The viewer shows a sortable grid:
- Column headers display data types (e.g.,
int64,object). - Use the column headers to sort ascending/descending.
- Pagination controls at the bottom let you page through large datasets; adjust the page size if needed.
Click the inline plot icon (a small chart symbol) inside the viewer to reproduce the matplotlib figure directly beneath the cell output, confirming the viewer’s plotting integration.
- Column headers display data types (e.g.,
Expected checks
- The Variable Explorer lists
dfas apandas.DataFramewith the expected number of rows and columns. - Opening the DataFrame viewer shows column names matching the CSV header and a sample of rows that correspond to the source file.
- Clicking the inline plot icon renders a figure below the cell; the axes labels and title match the code you executed.
- If you modify the cell and rerun, the Variable Explorer updates the variable’s shape and the viewer reflects the new data.
Recovery options (rollback)
Executing a notebook cell changes the kernel state (variables are defined). If you need to revert to a clean state:
- Restart the kernel – Kernel → Restart from the notebook toolbar. This clears all variables; you must rerun any setup cells.
- Reset specific variables – In a new cell, run
%reset -f(IPython magic) to delete all user‑defined variables, ordel dfto remove only the DataFrame. - Undo cell output – Click the cell’s output area and press Delete to remove the printed table and plot while keeping the variable in memory (useful for cleaning the view).
Limitations and practical verification
- Very large DataFrames (hundreds of thousands of rows or more) can make the Variable Explorer sluggish or unresponsive. Mitigation: sample the data before inspection, e.g.,
df_sample = df.sample(n=10000, random_state=42), or enable pagination limits in the viewer settings. - Kernel changes require a restart; any variables from the previous kernel are lost unless you have saved them to disk (e.g.,
df.to_pickle('df.pkl')) and reloaded them after the switch. - To confirm that the environment is correctly activated, check the kernel selector label after attaching; it should display the conda environment name or the path to the Python interpreter.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.