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 pandas typecheck (#808)

Akshay Agrawalb3f1096632ee
diff --git a/marimo/_plugins/ui/_impl/dataframes/handlers.py b/marimo/_plugins/ui/_impl/dataframes/handlers.py
index 58f9852d07..4181276831 100644
--- a/marimo/_plugins/ui/_impl/dataframes/handlers.py
+++ b/marimo/_plugins/ui/_impl/dataframes/handlers.py
@@ -178,7 +178,11 @@ class TransformHandlers:
column_id: transform.aggregations
for column_id in transform.column_ids
}
- return df.agg(dict_of_aggs) # type: ignore[arg-type]
+
+ # Pandas type-checking doesn't like the fact that the values
+ # are lists of strings (function names), even though the docs permit
+ # such a value
+ return cast("pd.DataFrame", df.agg(dict_of_aggs)) # type: ignore[arg-type]
@staticmethod
def handle_select_columns(