A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
docs: fix data editor example (#4552)
Akshay Agrawald42cd50eb807
diff --git a/examples/ui/data_editor.py b/examples/ui/data_editor.pyindex c985b7a81b..c104cfa6d6 100644--- a/examples/ui/data_editor.py+++ b/examples/ui/data_editor.py@@ -1,3 +1,5 @@++import marimo__generated_with = "0.12.9"@@ -23,36 +25,29 @@ def _():@app.cell-def _(DATA_FILE, os):+def _(DATA_FILE, mo, os):+ import polars as pl+if not os.path.exists(DATA_FILE):from vega_datasets import datadata.cars().to_csv(DATA_FILE)-- import polars as pl-- df = pl.read_csv(DATA_FILE)- return data, df, pl---def _(df, mo):- editor = mo.ui.data_editor(df).form(bordered=False)+ editor = mo.ui.data_editor(pl.read_csv(DATA_FILE)).form(bordered=False)editorreturn (editor,)[email protected](hide_code=True)def _(mo):- mo.md(- "The following cell writes the updated dataframe to disk when the submit button is clicked."- )+ mo.md("""The following cell writes the updated dataframe to disk when the submit button is clicked.""")return@app.cell-def _(DATA_FILE, editor):+def _(DATA_FILE, editor, mo):+ mo.stop(editor.value is None, mo.md("Submit your changes."))+editor.value.write_csv(DATA_FILE)return