Open mscolnick opened 3 weeks ago
Hey @mscolnick , thanks for reporting the issue. I have some mixed feelings about this, as I would not be sure what to expect as output.
What I mean by that: over does end up applying only to the reduction nw.min/pl.min
and not the entire expression (nor I would know what to expect by that). By changing the code to:
df.with_columns(
(nw.col("start") - nw.min("start").over("item")).alias("shifted")
)
the result is consistent across backends.
I apologize if I am missing something 🙈
Ah, I got it. I am probably using the API wrong. I was doing:
(
pl.col("year") * 12
+ pl.col("month")
- pl.min("year") * 12
- pl.min("month")
+ 1
).over("project")
but since this worked (in polars), I didn't think twice about doing
(
pl.col("year") * 12
+ pl.col("month")
- pl.min("year").over("project") * 12
- pl.min("month").over("project")
+ 1
)
Makes sense, and fine to close!
thanks for the report!
if we only support reductions with over
, then I think this should raise
Our current Expr API for pandas-like and pyarrow does not distinguish between aggregation or not, while for Dask it does. Standardizing it would definitly help in the long term, and yield more control in each operation
Describe the bug
Steps or code to reproduce the bug
https://static.marimo.app/static/narwhals-bug-bo1z
Expected results
Expected the results of polars. Values are incrementing.
Actual results
Values are the same
Please run narwhals.show_version() and enter the output below.