Skip to content

Commit 4a45787

Browse files
code sample for pandas-dev#46867
1 parent 6a8dfd2 commit 4a45787

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

bisect/46867.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# BUG: groupby.transform with execution engine numba does not work in multiindex case since 1.3 #46867
2+
3+
import pandas as pd
4+
5+
print(pd.__version__)
6+
7+
df = pd.DataFrame([{"A": 1, "B": 2, "C": 3}]).set_index(["A", "B"])
8+
9+
10+
def numba_func(values, index):
11+
return 1
12+
13+
14+
result = df.groupby("A").transform(numba_func, engine="numba")
15+
print(result)
16+
17+
expected = pd.DataFrame([{"A": 1, "B": 2, "C": 1.0}]).set_index(["A", "B"])
18+
pd.testing.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)