A simple way to explore your data through a Tableau-like interface directly in your Panel data applications.
panel-graphic-walker
brings the power of Graphic Walker to your data science workflow, seamlessly integrating interactive data exploration into notebooks and Panel applications. Effortlessly create dynamic visualizations, analyze datasets, and build dashboards—all within a Pythonic, intuitive interface.
panel-graphic-walker
takes care of the rest.This project is in early stages, so if you find a version that suits your needs, it’s recommended to pin your version, as updates may introduce changes.
Install panel-graphic-walker
via pip
:
pip install panel-graphic-walker
Here’s an example of how to create a simple GraphicWalker
pane:
import pandas as pd
import panel as pn
from panel_gwalker import GraphicWalker
pn.extension()
df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000)
GraphicWalker(df).servable()
You may also configure the fields
(data columns) manually:
import pandas as pd
import panel as pn
from panel_gwalker import GraphicWalker
pn.extension()
df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000)
fields = [
{
"fid": "t_county",
"name": "t_county",
"semanticType": "nominal",
"analyticType": "dimension",
},
{
"fid": "t_model",
"name": "t_model",
"semanticType": "nominal",
"analyticType": "dimension",
},
{
"fid": "t_cap",
"name": "t_cap",
"semanticType": "quantitative",
"analyticType": "measure",
},
]
GraphicWalker(df, fields=fields).servable()
You can get the full list of fields via GraphicWalker(df).calculated_fields()
.
By default, the appearance is determined by the value of pn.config.theme
. However, you can manually change this, for example, to dark
or media
. media
corresponds to the user's preference as set in the browser.
import pandas as pd
import panel as pn
from panel_gwalker import GraphicWalker
pn.extension()
df = pd.read_csv(
"https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000
)
GraphicWalker(df, appearance="media").servable()
Extra configuration options are available via the Graphic Walker API. For instance, you can change the language to Japanese:
import pandas as pd
import panel as pn
from panel_gwalker import GraphicWalker
pn.extension()
df = pd.read_csv(
"https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000
)
config = {
"i18nLang": "ja-JP"
}
GraphicWalker(df, config=config).servable()
You can export the current chart(s) from the client to the server by running the asynchronous export
method:
import pandas as pd
import panel as pn
from panel_gwalker import GraphicWalker
pn.extension()
df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz", nrows=10000)
walker = GraphicWalker(df)
exported = pn.pane.JSON(depth=3)
async def export(_):
exported.object = await walker.export()
pn.Column(
walker,
pn.Row(
pn.widgets.ButtonIcon(icon="download", on_click=export, active_icon='check', toggle_duration=1000),
exported,
)
).servable()
In some environments you may meet message or client side data limits. To handle larger datasets, you can offload the computation to the server.
First you will need to install extra dependencies:
pip install panel-graphic-walker[server]
Then you can use server side computation with server_computation=True
:
import pandas as pd
import panel as pn
from panel_gwalker import GraphicWalker
pn.extension()
df = pd.read_csv("https://datasets.holoviz.org/windturbines/v1/windturbines.csv.gz")
# Enable server-side computation for scalable data processing
walker = GraphicWalker(df, server_computation=True)
pn.Column(
walker,
walker.param.server_computation,
).servable()
This setup allows your application to manage larger datasets efficiently by leveraging server resources for data processing.
Please note that if running on Pyodide the computations will always take place on the client.
object
(DataFrame): The data for exploration. Please note that if you update the object
, then the existing chart(s) will not be deleted and you will have to create a new one manually to use the new dataset.fields
(list): Optional specification of fields (columns).server_computation
(bool): Optional. If True the computations will take place on the Panel server or in the Jupyter kernel instead of the client to scale to larger datasets. Default is False.appearance
(str): Optional dark mode preference: 'light', 'dark' or 'media'. If not provided the appearance is derived from pn.config.theme
.theme
(str): Optional chart theme: 'vega' (default), 'g2' or 'streamlit'.config
(dict): Optional additional configuration for Graphic Walker. See the Graphic Walker API for more details.calculated_fields()
: Returns a list of fields
calculated from the object
. This is a
great starting point if you want to provide custom fields
.export(mode: 'code' | 'svg' = 'svg', scope: 'current' | 'all', timeout: int = 5000)
Returns chart(s) from the frontend exported either as Vega specifications or as SVG strings.Our dream is that this package is super simple to use and supports your use cases:
Contributions and co-maintainers are very welcome! Please submit issues or pull requests to the GitHub repository. Check out the DEVELOPER_GUIDE for more information.