|
import marimo |
|
|
|
__generated_with = "0.9.18" |
|
app = marimo.App(width="full") |
|
|
|
|
|
@app.cell |
|
def __(): |
|
datasets = [ |
|
|
|
"scikit-learn/iris/Iris.csv", |
|
"scikit-learn/adult-census-income/adult.csv", |
|
"scikit-learn/auto-mpg/auto-mpg.csv", |
|
"scikit-learn/credit-card-clients/UCI_Credit_Card.csv", |
|
"scikit-learn/Fish/Fish.csv", |
|
"scikit-learn/tips/tips.csv", |
|
] |
|
return (datasets,) |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(mo): |
|
mo.md(r"""## Select a dataset""") |
|
return |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(datasets, mo): |
|
dataset = mo.ui.dropdown(datasets, value=datasets[0], label="Select a dataset") |
|
no_limit = mo.ui.switch(label="Limit 1000", value=True) |
|
mo.hstack([dataset, no_limit]) |
|
return dataset, no_limit |
|
|
|
|
|
@app.cell |
|
def __(dataset, mo, no_limit): |
|
explore = mo.sql( |
|
f""" |
|
CREATE OR REPLACE TEMP TABLE explore |
|
AS (FROM 'hf://datasets/{dataset.value}') |
|
{'LIMIT 1000' if no_limit.value else ''}; |
|
|
|
FROM explore; |
|
""" |
|
) |
|
return (explore,) |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(mo): |
|
mo.md(r"""## Summary""") |
|
return |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(explore, mo): |
|
_schema = mo.accordion({"Schema": explore.schema}) |
|
|
|
mo.md(f""" |
|
* Total rows: **{len(explore):,}** |
|
* Total columns: **{len(explore.columns)}** |
|
|
|
{_schema} |
|
""") |
|
return |
|
|
|
|
|
@app.cell |
|
def __(explore): |
|
explore.describe() |
|
return |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(mo): |
|
mo.md("""## Manipulate the data""") |
|
return |
|
|
|
|
|
@app.cell |
|
def __(explore, mo): |
|
transformed = mo.ui.dataframe(explore) |
|
transformed |
|
return (transformed,) |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(mo): |
|
mo.md(r"""## Explore the data""") |
|
return |
|
|
|
|
|
@app.cell |
|
def __(mo, transformed): |
|
mo.ui.data_explorer(transformed.value) |
|
return |
|
|
|
|
|
@app.cell(hide_code=True) |
|
def __(): |
|
|
|
import marimo as mo |
|
import polars |
|
return mo, polars |
|
|
|
|
|
if __name__ == "__main__": |
|
app.run() |
|
|