Skip to content

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.

fix: change back to csv parsing for data editor (#4227)

Shahmir Varqha037de31fd913
diff --git a/frontend/src/plugins/impl/DataEditorPlugin.tsx b/frontend/src/plugins/impl/DataEditorPlugin.tsx
index 959602c320..5ce0719fc3 100644
--- a/frontend/src/plugins/impl/DataEditorPlugin.tsx
+++ b/frontend/src/plugins/impl/DataEditorPlugin.tsx
@@ -14,6 +14,8 @@ import gridCss from "./data-editor/grid.css?inline";
import agGridCss from "ag-grid-community/styles/ag-grid.css?inline";
import agThemeCss from "ag-grid-community/styles/ag-theme-quartz.css?inline";
import { DATA_TYPES } from "@/core/kernel/messages";
+import { toFieldTypes } from "@/components/data-table/types";
+import { getVegaFieldTypes } from "./vega/utils";
type CsvURL = string;
type TableData<T> = T[] | CsvURL;
@@ -90,10 +92,12 @@ const LoadingDataEditor = (props: Props) => {
return props.data;
}
+ const withoutExternalTypes = toFieldTypes(props.fieldTypes ?? []);
+
// Otherwise, load the data from the URL
return await vegaLoadData(
props.data,
- { type: "json" },
+ { type: "csv", parse: getVegaFieldTypes(withoutExternalTypes) },
{ handleBigIntAndNumberLike: true },
);
}, [props.fieldTypes, props.data]);
diff --git a/marimo/_smoke_tests/tables/rich_elements.py b/marimo/_smoke_tests/tables/rich_elements.py
index 2f2eb4b855..ac9f8a1b72 100644
--- a/marimo/_smoke_tests/tables/rich_elements.py
+++ b/marimo/_smoke_tests/tables/rich_elements.py
@@ -193,5 +193,26 @@ def _(mo):
return
+def _(mo, pd, pl):
+ pd.DataFrame({"button": [mo.ui.button()]})
+
+ pl.DataFrame({"button": mo.ui.button()})
+ mo.ui.table({"button": mo.ui.button()})
+ return
+
+
+def _(data, mo):
+ mo.ui.experimental_data_editor(data=data, label="Edit Data")
+ return
+
+
+def _(data, mo):
+ mo.ui.data_explorer(data)
+ return
+
+
if __name__ == "__main__":
app.run()