-
Notifications
You must be signed in to change notification settings - Fork 172
Closed
Labels
bug: incorrect resultSomething isn't workingSomething isn't workinghigh priorityYour PR will be reviewed very quickly if you address thisYour PR will be reviewed very quickly if you address this
Description
Describe the bug
For expressions that accept arguments, these are not passed along in group_by context (e.g. ddof in std).
Steps or code to reproduce the bug
import narwhals as nw
import pandas as pd
import polars as pl
data = {"a": [1, 1, 1, 1, 1, 2, 2, 2, 2, 2], "b": list(range(10))}
nw.from_native(pl.DataFrame(data)).group_by("a").agg(nw.col("b").std(ddof=2)).to_native()
shape: (2, 2)
┌─────┬──────────┐
│ a ┆ b │
│ --- ┆ --- │
│ i64 ┆ f64 │
╞═════╪══════════╡
│ 2 ┆ 1.825742 │
│ 1 ┆ 1.825742 │
└─────┴──────────┘
nw.from_native(pd.DataFrame(data)).group_by("a").agg(nw.col("b").std(ddof=2)).to_native()
a b
0 1 1.581139
1 2 1.581139
# which is the same as ddof=1
nw.from_native(pd.DataFrame(data)).group_by("a").agg(nw.col("b").std(ddof=1)).to_native()
a b
0 1 1.581139
1 2 1.581139Expected results
Arguments to be passed along or raise
Actual results
Arguments get ignored
Please run narwhals.show_version() and enter the output below.
System:
python: 3.12.2 (main, Feb 25 2024, 16:35:05) [GCC 11.4.0]
Python dependencies:
narwhals: 1.18.4
pandas: 2.2.3
polars: 1.17.1
cudf:
modin: 0.32.0
pyarrow: 18.1.0
numpy: 2.1.3Relevant log output
No response
MarcoGorelli
Metadata
Metadata
Assignees
Labels
bug: incorrect resultSomething isn't workingSomething isn't workinghigh priorityYour PR will be reviewed very quickly if you address thisYour PR will be reviewed very quickly if you address this