Closed carecodeconnect closed 1 month ago
Hi @carecodeconnect , thanks for your feedback.
I will try to reproduce this bug in quarto and find out the cause.
Thank you! I thought it might also be due to creating a Quarto presentation, rather than a document. But when I previewed the document, it hangs on Loading Graphic-Walker UI...
and the terminal returns:
Watching files for changes
/ipylab.js (404: Not Found)
Hi @carecodeconnect
This is because pygwalker can't use Jupyter's communication module in Quarto HTML. Currently, all data needs to be rendered to the frontend (with calculations done by JavaScript).
This is a temporary solution code.
# Pygwalker in Quarto
```{python}
import pandas as pd
import pygwalker as pyg
df = pd.read_csv("xxx")
walker = pyg.walk(df, kernel_computation=False, env="JupyterConvert")
In next version, pygwalker will try to detect Quarto environment and automatically switch to JupyterConvert mode.
Thank you for your help! I tried this revised code to display a map of my pandas
DataFrame of 2 million rows in both a Quarto .qmd
document and a Jupyter notebook. I'm attempting to plot the lat
and lng
coordinates.
Unfortunately, with kernel_computation=False
, the execution is very slow, and it takes too long (I waited several minutes and had to stop it). The previous code I posted plots the geospatial data fine in a Jupyter notebook, I guess because it is using duckdb
in the backend. I've ran into the same problem using leaflet
or folium
with Python or R to plot this map.
I wonder if the root cause is the 2 million row DataFrame? I tried datashader
, hvplot
, holoviews
, bokeh
for the map, which works, but is not nearly as nice as leaflet
and is not interactive. I think the root cause might be how the points are plotted using leaflet
/folium
without duckdb
. (Using a for
loop to plot the points is too computationally demanding). Maybe there is a way to use duckdb
and render the map using leaflet
/folium
in R or Python, to just display the interactive map (for now, without the PyGWalker UI).
It's frustrating because the map works fine with PyGWalker inside the Jupyter notebook, but my presentation/report is written in Quarto.
pygwalker has updated a experimental feature: component api. I’m not sure if it can solve your problem.
pygwalker version: pygwalker==0.4.9.4a2
example:
If you need a UI that can be interactively explored(base on the duckdb) in Quarto HTML, currently pygwalker cannot support this feature.
But I will consider using wasm duckdb to implement this feature in the future.
Describe the bug PyGWalker does not render in a Quarto presentation.
To Reproduce Steps to reproduce the behavior:
This code is within a Quarto
.qmd
file which I am running inside VS Code:Expected behavior The GraphicWalker GUI should render in the Quarto presentation when rendered as
.html
.It renders fine inside the VS Code Interactive viewer.
But when the Quarto document is rendered as a
presentation.html
file, after runningquarto preview /mnt/data/projects/car-sales/notebooks/presentation.qmd --no-browser --no-watch-inputs
, I get these errors:Screenshots
Versions
0.4.9.3
3.10.14
1.5.6
Additional context
I have a feeling I'm missing a JupyterLab widget for PyGWalker. If so, how do I install it?