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
chore: Add support for narwhals `Time` dtype (#4019)
Francesco Bruzzesic5b0ac772cb2
diff --git a/marimo/_plugins/ui/_impl/tables/narwhals_table.py b/marimo/_plugins/ui/_impl/tables/narwhals_table.pyindex 2fef149b40..0d28d6e9fc 100644--- a/marimo/_plugins/ui/_impl/tables/narwhals_table.py+++ b/marimo/_plugins/ui/_impl/tables/narwhals_table.py@@ -228,14 +228,16 @@ class NarwhalsTableManager(true=cast(int, col.sum()),false=cast(int, total - col.sum()),)- if col.dtype == nw.Date:+ if (col.dtype == nw.Date) or (+ getattr(nw, "Time", None) is not None and col.dtype == nw.Time # type: ignore[attr-defined]+ ):return ColumnSummary(total=total,nulls=col.null_count(),min=col.min(),max=col.max(),mean=col.mean(),- # Quantile not supported on date type+ # Quantile not supported on date and time types# median=col.quantile(0.5, interpolation="nearest"),)if is_narwhals_temporal_type(col.dtype):diff --git a/tests/_plugins/ui/_impl/tables/snapshots/narwhals.field_types.json b/tests/_plugins/ui/_impl/tables/snapshots/narwhals.field_types.jsonindex 2b1bbb5b9d..3e928d9978 100644--- a/tests/_plugins/ui/_impl/tables/snapshots/narwhals.field_types.json+++ b/tests/_plugins/ui/_impl/tables/snapshots/narwhals.field_types.json@@ -12,7 +12,7 @@["category", ["string", "Categorical"]],["set", ["unknown", "Object"]],["imaginary", ["unknown", "Object"]],- ["time", ["unknown", "Unknown"]],+ ["time", ["unknown", "Time"]],["duration", ["number", "Duration(time_unit='us')"]],["mixed_list", ["unknown", "List(String)"]]]