Spaces:
Sleeping
Sleeping
Jesse Hartman
commited on
Commit
·
f30e98e
1
Parent(s):
3ce049f
hide those markdowns
Browse files
polars/tutorial_dataframe_transformer.py
CHANGED
|
@@ -12,11 +12,11 @@
|
|
| 12 |
|
| 13 |
import marimo
|
| 14 |
|
| 15 |
-
__generated_with = "0.14.
|
| 16 |
app = marimo.App(width="medium")
|
| 17 |
|
| 18 |
|
| 19 |
-
@app.cell
|
| 20 |
def _(mo):
|
| 21 |
mo.md(
|
| 22 |
r"""
|
|
@@ -58,7 +58,7 @@ def _(json_data, pl):
|
|
| 58 |
return (demand,)
|
| 59 |
|
| 60 |
|
| 61 |
-
@app.cell
|
| 62 |
def _(mo):
|
| 63 |
mo.md(
|
| 64 |
r"""
|
|
@@ -71,7 +71,7 @@ def _(mo):
|
|
| 71 |
return
|
| 72 |
|
| 73 |
|
| 74 |
-
@app.cell
|
| 75 |
def _(mo):
|
| 76 |
mo.md(
|
| 77 |
r"""
|
|
@@ -88,7 +88,7 @@ def _(mo):
|
|
| 88 |
return
|
| 89 |
|
| 90 |
|
| 91 |
-
@app.cell
|
| 92 |
def _(mo):
|
| 93 |
mo.md(
|
| 94 |
r"""
|
|
@@ -105,7 +105,7 @@ def _(demand: "pl.LazyFrame"):
|
|
| 105 |
return
|
| 106 |
|
| 107 |
|
| 108 |
-
@app.cell
|
| 109 |
def _(mo):
|
| 110 |
mo.md(
|
| 111 |
r"""
|
|
@@ -119,7 +119,7 @@ def _(mo):
|
|
| 119 |
return
|
| 120 |
|
| 121 |
|
| 122 |
-
@app.cell
|
| 123 |
def _(mo):
|
| 124 |
mo.md(
|
| 125 |
r"""
|
|
@@ -142,7 +142,7 @@ def _(demand_table):
|
|
| 142 |
return
|
| 143 |
|
| 144 |
|
| 145 |
-
@app.cell
|
| 146 |
def _(mo):
|
| 147 |
mo.md(
|
| 148 |
r"""I like to use this feature to select groupings based on summary statistics so I can quickly explore subsets of categories. Let me show you what I mean."""
|
|
@@ -175,7 +175,7 @@ def _(summary_table):
|
|
| 175 |
return
|
| 176 |
|
| 177 |
|
| 178 |
-
@app.cell
|
| 179 |
def _(mo):
|
| 180 |
mo.md(
|
| 181 |
r"""
|
|
@@ -199,7 +199,7 @@ def _(demand: "pl.LazyFrame", pl, summary_table):
|
|
| 199 |
return
|
| 200 |
|
| 201 |
|
| 202 |
-
@app.cell
|
| 203 |
def _(mo):
|
| 204 |
mo.md(
|
| 205 |
"""You can learn more about joins in Polars by checking out my other interactive notebook here: https://marimo.io/p/@jesshart/basic-polars-joins"""
|
|
@@ -207,7 +207,7 @@ def _(mo):
|
|
| 207 |
return
|
| 208 |
|
| 209 |
|
| 210 |
-
@app.cell
|
| 211 |
def _(mo):
|
| 212 |
mo.md(r"""## Use `mo.ui.dataframe`""")
|
| 213 |
return
|
|
@@ -220,7 +220,7 @@ def _(demand: "pl.LazyFrame", mo):
|
|
| 220 |
return demand_cached, mo_dataframe
|
| 221 |
|
| 222 |
|
| 223 |
-
@app.cell
|
| 224 |
def _(mo):
|
| 225 |
mo.md(
|
| 226 |
r"""Below I simply call the object into view. We will play with it in the following cells."""
|
|
@@ -234,7 +234,7 @@ def _(mo_dataframe):
|
|
| 234 |
return
|
| 235 |
|
| 236 |
|
| 237 |
-
@app.cell
|
| 238 |
def _(mo):
|
| 239 |
mo.md(
|
| 240 |
r"""One way to group this data in polars code directly would be to group by product family to get the mean. This is how it is done in polars:"""
|
|
@@ -251,7 +251,7 @@ def _(demand_cached, pl):
|
|
| 251 |
return (demand_agg,)
|
| 252 |
|
| 253 |
|
| 254 |
-
@app.cell
|
| 255 |
def _(mo):
|
| 256 |
mo.md(
|
| 257 |
f"""
|
|
|
|
| 12 |
|
| 13 |
import marimo
|
| 14 |
|
| 15 |
+
__generated_with = "0.14.9"
|
| 16 |
app = marimo.App(width="medium")
|
| 17 |
|
| 18 |
|
| 19 |
+
@app.cell(hide_code=True)
|
| 20 |
def _(mo):
|
| 21 |
mo.md(
|
| 22 |
r"""
|
|
|
|
| 58 |
return (demand,)
|
| 59 |
|
| 60 |
|
| 61 |
+
@app.cell(hide_code=True)
|
| 62 |
def _(mo):
|
| 63 |
mo.md(
|
| 64 |
r"""
|
|
|
|
| 71 |
return
|
| 72 |
|
| 73 |
|
| 74 |
+
@app.cell(hide_code=True)
|
| 75 |
def _(mo):
|
| 76 |
mo.md(
|
| 77 |
r"""
|
|
|
|
| 88 |
return
|
| 89 |
|
| 90 |
|
| 91 |
+
@app.cell(hide_code=True)
|
| 92 |
def _(mo):
|
| 93 |
mo.md(
|
| 94 |
r"""
|
|
|
|
| 105 |
return
|
| 106 |
|
| 107 |
|
| 108 |
+
@app.cell(hide_code=True)
|
| 109 |
def _(mo):
|
| 110 |
mo.md(
|
| 111 |
r"""
|
|
|
|
| 119 |
return
|
| 120 |
|
| 121 |
|
| 122 |
+
@app.cell(hide_code=True)
|
| 123 |
def _(mo):
|
| 124 |
mo.md(
|
| 125 |
r"""
|
|
|
|
| 142 |
return
|
| 143 |
|
| 144 |
|
| 145 |
+
@app.cell(hide_code=True)
|
| 146 |
def _(mo):
|
| 147 |
mo.md(
|
| 148 |
r"""I like to use this feature to select groupings based on summary statistics so I can quickly explore subsets of categories. Let me show you what I mean."""
|
|
|
|
| 175 |
return
|
| 176 |
|
| 177 |
|
| 178 |
+
@app.cell(hide_code=True)
|
| 179 |
def _(mo):
|
| 180 |
mo.md(
|
| 181 |
r"""
|
|
|
|
| 199 |
return
|
| 200 |
|
| 201 |
|
| 202 |
+
@app.cell(hide_code=True)
|
| 203 |
def _(mo):
|
| 204 |
mo.md(
|
| 205 |
"""You can learn more about joins in Polars by checking out my other interactive notebook here: https://marimo.io/p/@jesshart/basic-polars-joins"""
|
|
|
|
| 207 |
return
|
| 208 |
|
| 209 |
|
| 210 |
+
@app.cell(hide_code=True)
|
| 211 |
def _(mo):
|
| 212 |
mo.md(r"""## Use `mo.ui.dataframe`""")
|
| 213 |
return
|
|
|
|
| 220 |
return demand_cached, mo_dataframe
|
| 221 |
|
| 222 |
|
| 223 |
+
@app.cell(hide_code=True)
|
| 224 |
def _(mo):
|
| 225 |
mo.md(
|
| 226 |
r"""Below I simply call the object into view. We will play with it in the following cells."""
|
|
|
|
| 234 |
return
|
| 235 |
|
| 236 |
|
| 237 |
+
@app.cell(hide_code=True)
|
| 238 |
def _(mo):
|
| 239 |
mo.md(
|
| 240 |
r"""One way to group this data in polars code directly would be to group by product family to get the mean. This is how it is done in polars:"""
|
|
|
|
| 251 |
return (demand_agg,)
|
| 252 |
|
| 253 |
|
| 254 |
+
@app.cell(hide_code=True)
|
| 255 |
def _(mo):
|
| 256 |
mo.md(
|
| 257 |
f"""
|