-
Notifications
You must be signed in to change notification settings - Fork 700
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #655 from Haleshot/add-marimo-example
Add marimo example
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Examples | ||
This folder contains example implementations of Pygwalker across different interfaces. | ||
|
||
- [`component_demo.ipynb`](component_demo.ipynb): Creating various visualizations using Pygwalker's core components | ||
- [`dash_demo.py`](dash_demo.py): Integration of Pygwalker with Dash framework | ||
- [`gradio_demo.py`](gradio_demo.py): Using Pygwalker within Gradio applications | ||
- [`html_demo.py`](html_demo.py): Generating standalone HTML outputs with Pygwalker | ||
- [`jupyter_demo.ipynb`](jupyter_demo.ipynb): Basic Pygwalker usage in Jupyter environments | ||
- [`marimo_demo.py`](marimo_demo.py): Interactive data exploration using Pygwalker in Marimo notebooks | ||
- [`streamlit_demo.py`](streamlit_demo.py): Embedding Pygwalker visualizations in Streamlit apps | ||
- [`web_server_demo.py`](web_server_demo.py): Setting up Pygwalker with a web server | ||
|
||
> [!TIP] | ||
> To run the Marimo example, use: | ||
> ```shell | ||
> uvx marimo run --sandbox marimo_demo.py | ||
> ``` | ||
> if you have [`uv`](https://docs.astral.sh/uv/) installed, or | ||
> ```shell | ||
> marimo run marimo_demo.py | ||
> ``` | ||
> if you don't have uv installed (you'll need to manually install its dependencies; easier through the package manager sidebar option in marimo). | ||
> To edit the notebook source code, replace `run` with `edit` in the above commands. | ||
## Running examples | ||
Each example includes its own set of requirements and setup instructions within the file. Make sure you have Pygwalker installed: | ||
```shell | ||
pip install pygwalker | ||
``` | ||
Additional dependencies may be required based on the specific interface you're using (e.g., streamlit, dash, gradio). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# /// script | ||
# requires-python = ">=3.12" | ||
# dependencies = [ | ||
# "marimo", | ||
# "pandas==2.2.3", | ||
# "pygwalker==0.4.9.13", | ||
# ] | ||
# /// | ||
|
||
import marimo | ||
|
||
__generated_with = "0.9.15" | ||
app = marimo.App(width="medium") | ||
|
||
|
||
@app.cell | ||
def __(pd, walk): | ||
_df = pd.read_csv("https://kanaries-app.s3.ap-northeast-1.amazonaws.com/public-datasets/bike_sharing_dc.csv") | ||
walk(_df) | ||
return | ||
|
||
|
||
@app.cell | ||
def __(pd, pyg): | ||
_df = pd.read_csv("https://kanaries-app.s3.ap-northeast-1.amazonaws.com/public-datasets/bike_sharing_dc.csv") | ||
pyg.walk(_df) | ||
return | ||
|
||
|
||
@app.cell | ||
def __(): | ||
# import libraries | ||
import marimo as mo | ||
import pandas as pd | ||
from pygwalker.api.marimo import walk # Usage - directly use walk("<dataset-path>") | ||
import pygwalker.api.marimo as pyg # Usage - directly use pyg.walk("<dataset-path>") | ||
return mo, pd, pyg, walk | ||
|
||
|
||
if __name__ == "__main__": | ||
app.run() |