# AI use cases for Pygwalker (Kanaries/pygwalker)

Repo: [Kanaries/pygwalker](https://github.com/Kanaries/pygwalker) | Use cases: 3 | Page: https://dedupedai.com/use-cases/kanaries-pygwalker/

PyGWalker turns a pandas, polars or pyarrow dataframe into an interactive, Tableau-style drag-and-drop interface inside Jupyter. It is the Python binding of Graphic Walker and lets you build charts, clean and filter data, profile columns and save chart configs, with computation in the browser, in a local DuckDB kernel or in Kanaries cloud. Charts can be exported as images or as reproducible Python code, and the same UI can be hosted in a Streamlit app.

This file holds every use case of this repo. Each one starts with a "## " heading and ends with its URL.

- Explore a dataframe with drag-and-drop charts in Jupyter: https://dedupedai.com/use-cases/kanaries-pygwalker/explore-a-dataframe-with-drag-and-drop/
- Turn charts you built by hand into reproducible code: https://dedupedai.com/use-cases/kanaries-pygwalker/turn-exploration-into-reproducible-code/
- Share a self-serve data explorer as a Streamlit app: https://dedupedai.com/use-cases/kanaries-pygwalker/share-an-explorer-as-a-streamlit-app/

## How to explore a dataframe with drag-and-drop charts in Jupyter with Pygwalker

Repo: [Kanaries/pygwalker](https://github.com/Kanaries/pygwalker) | Difficulty: Beginner | Time: 10 minutes | Basis: From the README

Call pyg.walk on a dataframe to get a Tableau-like interface right in your notebook.

**Who it is for:** An analyst who wants to look at a new dataset fast without writing matplotlib code for every chart.

**The problem:** Writing plotting code for every question slows down early exploration of a dataset.

**The outcome:** An interactive chart builder in your notebook, with filters, facets and a data profile table.

### Steps

1. Run `pip install pygwalker`, or `conda install -c conda-forge pygwalker`
2. In a notebook, import pandas as pd and Pygwalker as pyg
3. Load your data, for example `df = pd.read_csv('./bike_sharing_dc.csv')`
4. Run `walker = pyg.walk(df)` and drag fields onto rows and columns to build charts
5. Use the data table to see distributions, add filters or change data types

### Prompt to paste into your agent

```text
Using Kanaries/pygwalker, open <csv file> in a Jupyter notebook with pyg.walk and set it up with spec_path so my charts are saved. Suggest three charts I should build first to understand this dataset.
```

### Caveat

The UI runs inside the notebook, so it is for exploration rather than a finished report on its own.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kanaries-pygwalker/explore-a-dataframe-with-drag-and-drop/

## How to turn charts you built by hand into reproducible code with Pygwalker

Repo: [Kanaries/pygwalker](https://github.com/Kanaries/pygwalker) | Difficulty: Beginner | Time: 20 minutes | Basis: From the README

Save chart state with spec_path, then export it with to_code or as PNG and SVG files.

**Who it is for:** A data scientist who explored visually and now needs the same charts in a report or pipeline.

**The problem:** Charts made by clicking around are hard to reproduce or put under version control.

**The outcome:** Saved chart configs plus Python code and image files you can commit and rerun.

### Steps

1. Open the walker with a spec file: `walker = pyg.walk(df, spec_path="./chart_meta_0.json")`
2. Build your chart in the UI and click the save button
3. Export the image with `walker.save_chart_to_file("Chart 1", "chart1.svg", save_type="svg")` or export_chart_png
4. Get reproducible Python with `code = walker.to_code(dataset_name="df")`
5. Migrate older saved specs with pyg.spec.migrate before committing them

### Prompt to paste into your agent

```text
With Kanaries/pygwalker, open <dataframe> with a spec_path, and once I have saved <chart name> in the UI, export it to SVG and PNG and generate the reproducible code with to_code. Put the code in <script file>.
```

### Caveat

Chart export works on charts saved from the UI, so save first and then export.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kanaries-pygwalker/turn-exploration-into-reproducible-code/

## How to share a self-serve data explorer as a Streamlit app with Pygwalker

Repo: [Kanaries/pygwalker](https://github.com/Kanaries/pygwalker) | Difficulty: Intermediate | Time: 30 minutes | Basis: From the README

Host the PyGWalker UI in Streamlit so teammates can explore a dataset in the browser without a notebook.

**Who it is for:** An analyst whose colleagues keep asking for slightly different cuts of the same data.

**The problem:** Every new question becomes a request to the one person who has the notebook.

**The outcome:** A web app where anyone can drag fields to build their own charts on the shared dataset.

### Steps

1. Install Pygwalker and streamlit
2. Import StreamlitRenderer from Pygwalker.api.streamlit and set the page layout to wide
3. Wrap the renderer in a function decorated with st.cache_resource so memory does not explode
4. Create `StreamlitRenderer(df, spec_path="./gw_config.json", spec_io_mode="rw")` to let users save chart configs
5. Call renderer.explorer() and run the app with Streamlit

### Prompt to paste into your agent

```text
Build a Streamlit app with Kanaries/pygwalker that loads <dataset>, caches the StreamlitRenderer with st.cache_resource, saves chart configs to gw_config.json, and shows the explorer. Use computation="kernel" if the data is large.
```

### Caveat

With spec_io_mode set to rw, anyone using the app can change the saved chart config, so keep a backup.

Disclaimer: Third-party repos we don't own or vouch for. AI-generated use cases can be wrong: review everything and run at your own risk. Full text: https://dedupedai.com/disclaimer/

URL: https://dedupedai.com/use-cases/kanaries-pygwalker/share-an-explorer-as-a-streamlit-app/
