Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pygwalker example #2800

Merged
merged 1 commit into from
Nov 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions examples/third_party/pygwalker/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# /// script
# requires-python = ">=3.10"
# dependencies = [
# "pygwalker==0.4.9.13",
# "vega-datasets==0.9.0",
# ]
# ///
import marimo

__generated_with = "0.9.14"
app = marimo.App(width="medium")


@app.cell
def __():
import pygwalker as pyg
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to achieve rendering the Pygwalker interface using this import? I tried it with datasets hosted through cloud links (S3), tried running this example as is too and it results in the class instance being printed:
<pygwalker.api.pygwalker.PygWalker object at 0x00000124E362B470>

I have found using these imports useful:

from pygwalker.api.marimo import walk # Usage -> walk(_df, spec="spec.json")
import pygwalker.api.marimo as pyg # Usage -> pyg.walk(_df)

this is with regards to the way it was implemented in the Pygwalker PR.


from vega_datasets import data
return data, pyg


@app.cell
def __(data, pyg):
df = data.iris()

pyg.walk(df)
return (df,)


if __name__ == "__main__":
app.run()
Loading