PyGWalker Jupyter API Guide
This guide explains how to use PyGWalker in Jupyter notebooks, covering the main functions and their parameters.
Main Functions
1. walk()
Creates an interactive GraphicWalker instance.
import pygwalker as pyg
walker = pyg.walk(dataset)
2. render()
Renders a specific chart configuration.
import pygwalker as pyg
walker = pyg.render(dataset, spec="./gw_config.json")
3. table()
Displays the dataset as an interactive table.
import pygwalker as pyg
walker = pyg.table(dataset)
Common Parameters
Parameter | Type | Default | Description |
---|---|---|---|
dataset | Union[DataFrame, Connector] | - | Input data. See Dataset Of Walker for details. |
gid | Union[int, str] | None | GraphicWalker container div ID. Format: 'gwalker-{gid}'. Auto-generated if None. |
field_specs | Optional[Dict[str, FieldSpec]] | None | Field specifications. Auto-inferred if not specified. |
theme_key | Literal['vega', 'g2'] | 'g2' | Theme type for GraphicWalker. |
appearance | Literal['media', 'light', 'dark'] | 'media' | Theme setting. 'media' auto-detects OS theme. |
spec | str | "" | Chart configuration data (ID, JSON, or URL). |
kernel_computation | bool | None | Enables high-performance kernel computation for larger datasets. |
kanaries_api_key | str | "" | Kanaries API key. |
default_tab | Literal["data", "vis"] | "vis" | Default tab to show (only for walk() ). |
cloud_computation | bool | False | Enables cloud computation (uploads data to Kanaries cloud). |
Best Practices and Tips
-
Large Datasets: For CSV files > 1GB, use
kernel_computation=True
to enable high-performance processing. -
Theming:
- Set theme with
appearance='light'
orappearance='dark'
. - If PyGWalker's theme doesn't match Jupyter's, explicitly set the appearance.
- Set theme with
-
Saving Charts:
- Save to a file or export as code.
- Detailed guide on saving and sharing (opens in a new tab)
-
Performance: Use
kernel_computation=True
for larger datasets to leverage the internal DuckDB-based engine. -
Cloud Computation: Set
cloud_computation=True
to use Kanaries cloud for data processing (requires API key).
Examples
- Kaggle Demo: Airbnb EDA with PyGWalker (opens in a new tab)
- GitHub: Jupyter Notebook Demo (opens in a new tab)
For more advanced usage and integration examples, please refer to the PyGWalker documentation (opens in a new tab).
FAQ
My pygwalker cannot handle CSV > 1GB, what should I do?
PyGWalker has an internal engine based on DuckDB which allows you to handle much larger datasets with high performance. You can enable it with the kernel_computation=True
parameter.
How to set pygwalker's theme (light or dark)?
You can set the theme with the appearance
parameter. Available values: dark
| light
| media
. Default is media
which will automatically switch based on your system theme.
Why is my pygwalker dark but my Jupyter is light?
PyGWalker follows the system theme by default. However, some Jupyter environments cannot follow the system theme.
You can set the theme with appearance='light'
to make pygwalker use the light theme.
How to save the charts of pygwalker in Jupyter?
There are two ways to save pygwalker's charts and state: save it into a file or export as code. More details (opens in a new tab)