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: Altair 5.5 compat (#2947)

Marco Edward Gorelli0e83cc2ebbb6
diff --git a/marimo/_plugins/ui/_impl/tables/narwhals_table.py b/marimo/_plugins/ui/_impl/tables/narwhals_table.py
index 779e90bbda..a4c0961e99 100644
--- a/marimo/_plugins/ui/_impl/tables/narwhals_table.py
+++ b/marimo/_plugins/ui/_impl/tables/narwhals_table.py
@@ -54,7 +54,14 @@ class NarwhalsTableManager(
format_mapping: Optional[FormatMapping] = None,
) -> bytes:
_data = self.apply_formatting(format_mapping).as_frame()
- csv_str = _data.write_csv()
+ if nw.get_level(_data) == "interchange":
+ # `write_csv` isn't supported by interchange-level-only
+ # DataFrames, so we convert to PyArrow in this case
+ csv_str = nw.from_native(
+ _data.to_arrow(), eager_only=True
+ ).write_csv()
+ else:
+ csv_str = _data.write_csv()
if isinstance(csv_str, str):
return csv_str.encode("utf-8")
return cast(bytes, csv_str)