PyGWalker Notebook APIs
In notebooks, start with pygwalker.walk(df) or create a reusable pygwalker.Walker. The current default Jupyter rendering path is anywidget, so new code should omit env or use env="JupyterAnywidget".
import pygwalker as pyg
walker = pyg.walk(df, spec_path="./gw_config.json", computation="kernel")Quick decision table
| Need | Use | Why |
|---|---|---|
| Explore a DataFrame once | pyg.walk(df) | Smallest notebook call. |
| Reuse the same configuration | pyg.Walker(df, ...).show() | One object can render in notebooks, Streamlit, webserver, and HTML. |
| Render saved charts only | pyg.render(df, spec_path=...) | Opens the renderer view instead of the full explorer. |
| Show the table/profiling view | pyg.table(df) | Starts in the data/table mode. |
| Save chart state in a local file | spec_path="./gw_config.json" | Local chart state has a dedicated argument. |
pygwalker.walk
walk opens the full Graphic Walker explorer.
import pygwalker as pyg
walker = pyg.walk(
df,
spec_path="./gw_config.json",
computation="browser",
)Signature:
pyg.walk(
dataset,
gid=None,
*,
env="JupyterAnywidget",
field_specs=None,
theme_key="g2",
appearance="media",
spec="",
spec_path=None,
computation=None,
use_kernel_calc=None,
kernel_computation=None,
cloud_computation=False,
show_cloud_tool=True,
kanaries_api_key="",
default_tab="vis",
**kwargs,
)dataset can be a pandas DataFrame, polars DataFrame, pyarrow Table, database Connector, connector-style string, or reusable pygwalker.Walker.
Anywidget is the notebook default
New notebook code should use the anywidget path:
pyg.walk(df)
pyg.walk(df, env="JupyterAnywidget")
pyg.Walker(df).show()
pyg.Walker(df).show(env="jupyter-anywidget")Legacy Jupyter transport aliases still resolve to anywidget and emit deprecation warnings:
| Legacy value | Current behavior | Status |
|---|---|---|
env="Jupyter" | Treated as JupyterAnywidget | Deprecated, scheduled for removal in PyGWalker 0.7.0. |
env="JupyterWidget" | Treated as JupyterAnywidget | Deprecated, scheduled for removal in PyGWalker 0.7.0. |
Walker.show("jupyter-inline") | Treated as jupyter-anywidget | Deprecated, scheduled for removal in PyGWalker 0.7.0. |
Walker.show("jupyter-widget") | Treated as jupyter-anywidget | Deprecated, scheduled for removal in PyGWalker 0.7.0. |
Walker.show(env="auto") detects the current environment. In notebooks it resolves to jupyter-anywidget; outside notebooks it starts the webserver adapter.
Reuse pygwalker.Walker
Use Walker when chart state and computation mode should be defined once.
import pygwalker as pyg
walker = pyg.Walker(
df,
spec_path="./gw_config.json",
spec_io_mode="rw",
computation="kernel",
)
walker.show()Constructor:
pyg.Walker(
dataset,
gid=None,
*,
field_specs=None,
theme_key="g2",
appearance="media",
spec="",
spec_path=None,
spec_io_mode="rw",
computation=None,
use_kernel_calc=None,
kernel_computation=None,
cloud_computation=False,
show_cloud_tool=True,
kanaries_api_key="",
default_tab="vis",
**kwargs,
)Useful methods:
| Method | Returns | Use |
|---|---|---|
walker.core | PygWalker | Access the compatibility object used by older APIs. |
walker.show(env="auto", ...) | Walker | Display in notebook or webserver mode. |
walker.to_html() | str | Export static iframe HTML. Browser computation only. |
walker.to_html_without_iframe() | str | Export static HTML without the iframe wrapper. Browser computation only. |
walker.to_streamlit(**kwargs) | StreamlitRenderer | Reuse the constructor options in Streamlit. |
When a Walker is passed to another adapter, do not pass construction options again. This is rejected:
walker = pyg.Walker(df, spec_path="./gw_config.json", computation="browser")
# Raises ValueError: spec_path belongs on the original Walker.
pyg.walk(walker, spec_path="./other.json")Computation in notebooks
Use computation for new code.
pyg.walk(df, computation="browser")
pyg.walk(df, computation="kernel")
pyg.walk(df, computation="cloud", kanaries_api_key="...")kernel_computation, cloud_computation, and use_kernel_calc are legacy flags and are scheduled for removal in PyGWalker 0.7.0. If computation is set to "browser", "kernel", or "cloud", do not also set enabled legacy flags.
Notebook convert/static HTML output does not support live kernel or cloud computation. Use computation="browser" when the output must be static, or run PyGWalker in a live backend.
pygwalker.render
render shows saved charts without the full drag-and-drop explorer.
import pygwalker as pyg
pyg.render(df, spec_path="./gw_config.json", computation="browser")Signature:
pyg.render(
dataset,
spec="",
*,
theme_key="g2",
appearance="media",
spec_path=None,
computation=None,
kernel_computation=None,
kanaries_api_key="",
**kwargs,
)pygwalker.table
table opens PyGWalker's data table/profiling mode.
import pygwalker as pyg
pyg.table(df, spec_path="./gw_config.json")Signature:
pyg.table(
dataset,
*,
theme_key="g2",
appearance="media",
spec_path=None,
computation=None,
kernel_computation=None,
kanaries_api_key="",
**kwargs,
)