Skip to content

Commit

Permalink
modin can use fastpath too
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Mar 19, 2024
1 parent 8b2734d commit 4ff71b2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion narwhals/pandas_like/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ def evaluate_simple_aggregation(expr: PandasExpr, grouped: Any, keys: list[str])
if expr._depth == 0:
# e.g. agg(pl.len())
df = getattr(grouped, expr._function_name.replace("len", "size"))()
df = df.drop(columns=keys) if len(df.shape) > 1 else df.to_frame("size")
df = (
df.drop(columns=keys)
if len(df.shape) > 1
else df.reset_index(drop=True).to_frame("size")
)
return df.rename(columns={"size": expr._output_names[0]}) # type: ignore[index]
if expr._root_names is None or expr._output_names is None:
msg = "Expected expr to have root_names and output_names set, but they are None. Please report a bug."
Expand Down

0 comments on commit 4ff71b2

Please sign in to comment.