Skip to content
API Reference
Html APIs

Html API

Users can render the UI of Graphic Walker onto any application that supports rendering HTML.

However, the current approach only supports front-end computation and is not suitable for use with larger datasets.

to_html

import pygwalker as pyg
 
html_str = pyg.to_html(df)

Parameters

ParameterTypeDefaultDescription
datasetDataFrame-The dataframe to be used. refer Dataset Of Walker.
gidUnion[int, str]NoneID for the GraphicWalker container div, formatted as 'gwalker-{gid}'. If gid is None, it will be automatically generated.
field_specsOptional[Dict[str, FieldSpec]]NoneSpecifications of fields. Will be automatically inferred from dataset if not specified.
theme_keyLiteral['vega', 'g2']'g2'Theme type for the GraphicWalker.
darkLiteral['media', 'light', 'dark']'media'Theme setting. 'media' will auto-detect the OS theme.
specstr""Chart configuration data. Can be a configuration ID, JSON, or remote file URL.
default_tabLiteral["data", "vis"]"vis"default tab to show. Default to "vis".
**kwargsAny-Additional keyword arguments.

Example

export html file

import pandas as pd
import pygwalker as pyg
 
df = pd.read_csv('data.csv')
 
with open("demo.html", "w", encoding="utf-8") as f:
    f.write(pyg.to_html(df))

on shiny