Skip to content

Commit

Permalink
code sample for pandas-dev#46867
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjayhawkins committed May 18, 2022
1 parent 6a8dfd2 commit 4a45787
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bisect/46867.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# BUG: groupby.transform with execution engine numba does not work in multiindex case since 1.3 #46867

import pandas as pd

print(pd.__version__)

df = pd.DataFrame([{"A": 1, "B": 2, "C": 3}]).set_index(["A", "B"])


def numba_func(values, index):
return 1


result = df.groupby("A").transform(numba_func, engine="numba")
print(result)

expected = pd.DataFrame([{"A": 1, "B": 2, "C": 1.0}]).set_index(["A", "B"])
pd.testing.assert_frame_equal(result, expected)

0 comments on commit 4a45787

Please sign in to comment.