-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fc98f77
commit a700b38
Showing
17 changed files
with
314 additions
and
52 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
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
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
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
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,47 @@ | ||
import dask.dataframe as dd | ||
import duckdb | ||
import pandas as pd | ||
import panel as pn | ||
import polars as pl | ||
|
||
from panel_gwalker import GraphicWalker | ||
|
||
pn.extension() | ||
|
||
|
||
DATA = "https://datasets.holoviz.org/significant_earthquakes/v1/significant_earthquakes.parquet" | ||
df_pandas = pd.read_parquet(DATA) | ||
duckdb_relation = duckdb.sql("SELECT * FROM df_pandas") | ||
|
||
DATAFRAMES = { | ||
"pandas": df_pandas, | ||
"polars": pl.read_parquet(DATA), | ||
"dask": dd.read_parquet(DATA, npartitions=1), | ||
"duckdb": duckdb_relation, | ||
} | ||
|
||
select = pn.widgets.Select(options=list(DATAFRAMES), name="Data Source") | ||
kernel_computation = pn.widgets.Checkbox(name="Kernel Computation", value=False) | ||
|
||
|
||
@pn.depends(select, kernel_computation) | ||
def get_data(value, kernel_computation): | ||
data = DATAFRAMES[value] | ||
if not kernel_computation: | ||
try: | ||
data = data.head(10) | ||
except: | ||
data = data.df().head(10) | ||
try: | ||
return GraphicWalker( | ||
data, | ||
kernel_computation=kernel_computation, | ||
sizing_mode="stretch_width", | ||
tab="data", | ||
) | ||
except Exception as ex: | ||
msg = f"Combination of {value=} and {kernel_computation=} is currently not supported." | ||
return pn.pane.Alert(msg, alert_type="danger") | ||
|
||
|
||
pn.Column(select, kernel_computation, get_data).servable() |
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
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
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
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
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
Oops, something went wrong.