Spaces:
Running
Running
Try to fix run all again. Failed again.
Browse files- polars/05_reactive_plots.py +23 -12
polars/05_reactive_plots.py
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
|
12 |
import marimo
|
13 |
|
14 |
-
__generated_with = "0.11.
|
15 |
app = marimo.App(width="medium")
|
16 |
|
17 |
|
@@ -41,13 +41,17 @@ def _(mo):
|
|
41 |
|
42 |
@app.cell
|
43 |
def _(pl):
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
df = (
|
52 |
lz
|
53 |
# Filter data we consider relevant (somewhat arbitrary in this example)
|
@@ -66,7 +70,7 @@ def _(pl):
|
|
66 |
.collect()
|
67 |
)
|
68 |
df
|
69 |
-
return
|
70 |
|
71 |
|
72 |
@app.cell(hide_code=True)
|
@@ -361,10 +365,17 @@ def _(filtered_duration, mo, pl):
|
|
361 |
# Note that we cannot use dropdown due to the sheer number of elements being enormous:
|
362 |
all_artists = filtered_duration.select(pl.col("artists").str.split(';').explode().unique().sort())['artists'].to_list()
|
363 |
all_tracks = filtered_duration['track_name'].unique().sort().to_list()
|
364 |
-
|
365 |
-
|
366 |
# So we just provide freeform text boxes and filter ourselfves later
|
367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
|
369 |
|
370 |
@app.cell
|
|
|
11 |
|
12 |
import marimo
|
13 |
|
14 |
+
__generated_with = "0.11.16"
|
15 |
app = marimo.App(width="medium")
|
16 |
|
17 |
|
|
|
41 |
|
42 |
@app.cell
|
43 |
def _(pl):
|
44 |
+
# You can read directly from the Hugging Face dataset, in which case polars will only read the necessary data:
|
45 |
+
#repo_id, branch, file_path = (
|
46 |
+
# "maharshipandya/spotify-tracks-dataset",
|
47 |
+
# "~parquet",
|
48 |
+
# "default/train/0000.parquet",
|
49 |
+
#)
|
50 |
+
#URL = f"hf://datasets/{repo_id}@{branch}/{file_path}"
|
51 |
+
#lz = pl.scan_parquet(URL)
|
52 |
+
# Or save to a local file first if you want to avoid downloading it each time you run:
|
53 |
+
file_path = "spotify-tracks.parquet"
|
54 |
+
lz = pl.scan_parquet(file_path)
|
55 |
df = (
|
56 |
lz
|
57 |
# Filter data we consider relevant (somewhat arbitrary in this example)
|
|
|
70 |
.collect()
|
71 |
)
|
72 |
df
|
73 |
+
return df, file_path, lz
|
74 |
|
75 |
|
76 |
@app.cell(hide_code=True)
|
|
|
365 |
# Note that we cannot use dropdown due to the sheer number of elements being enormous:
|
366 |
all_artists = filtered_duration.select(pl.col("artists").str.split(';').explode().unique().sort())['artists'].to_list()
|
367 |
all_tracks = filtered_duration['track_name'].unique().sort().to_list()
|
368 |
+
alternative_filter_artist = mo.ui.dropdown(all_artists, value=None, searchable=True)
|
369 |
+
alternative_filter_track = mo.ui.dropdown(all_tracks, value=None, searchable=True)
|
370 |
# So we just provide freeform text boxes and filter ourselfves later
|
371 |
+
# (the "alternative_" in the name is just to avoid conflicts with the above cell,
|
372 |
+
# despite this being disabled marimo still requires global variables to be unique)
|
373 |
+
return (
|
374 |
+
all_artists,
|
375 |
+
all_tracks,
|
376 |
+
alternative_filter_artist,
|
377 |
+
alternative_filter_track,
|
378 |
+
)
|
379 |
|
380 |
|
381 |
@app.cell
|