Metadata-Version: 2.4
Name: pandalens
Version: 0.1.1
Summary: See what pandas does to your data, step by step, in a live browser tab. A teaching aid for beginners.
Author: Eric Nelson
License-Expression: MIT
Keywords: pandas,education,visualization,debugging,teaching
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Education
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Education
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pandas>=2.2
Requires-Dist: numpy
Dynamic: license-file

# pandalens

Watch what pandas does to your data, one step at a time.

```python
import pandalens          # opens a live view in your browser
import pandas as pd

df = pd.DataFrame({"k": [1, 1, 2], "x": [1.0, 2.0, 3.0]})
med = df.groupby("k")["x"].median()   # the browser shows the groups, colored
med = med.reset_index()               # ...and why the index became a column
```

Every pandas call you make (`merge`, `groupby`, `reset_index`, filtering, new columns, ...) appears as a step in
the browser tab, with before/after tables, colors showing which rows went where, and a plain-English explanation.
Use the step log on the left to review earlier steps, and the variables panel on the right to keep any
DataFrame or Series in view.

It works with breakpoints: the browser tab runs in its own process, so it keeps working while your program is paused.

## What is shown

Nearly everything you can call in pandas is recorded: creating DataFrames, `df['a']`, `df[mask]`, `.loc`/`.iloc`,
operators like `a + b` and `x > 0`, `merge`/`concat`/`join`, `groupby` (rows colored by group), `reset_index`,
`sort_values`, `fillna`, `rolling`, `.str`/`.dt` methods, `pivot_table`, `read_csv`, and hundreds more. Each step shows the
data before and after, highlights what changed, and explains it (in plain English for the common operations, and with
pandas' own one-line description for the rest).

## Controls

```python
pandalens.pause(); pandalens.resume()
with pandalens.group("my step"):      # show several calls as one entry
    ...
pandalens.show(df, "my table")        # snapshot any DataFrame
pandalens.clear()
pandalens.stop()
```

Set `PANDALENS_NO_BROWSER=1` to stop the browser from opening automatically (the address is printed instead).

## Requirements

Python 3.9+ and pandas 2.2 or newer.
Tested with pandas 2.2, 2.3 and 3.1 on Python 3.9, 3.12 and 3.13.

Status: early alpha, built as a teaching aid.
