Skip to content

Commit

Permalink
Add test groupby complex numbers (#56570)
Browse files Browse the repository at this point in the history
  • Loading branch information
aram-cinnamon authored Dec 21, 2023
1 parent 9379642 commit e00a7bc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pandas/tests/groupby/test_groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,24 @@ def test_groupby_complex():
tm.assert_series_equal(result, expected)


def test_groupby_complex_mean():
# GH 26475
df = DataFrame(
[
{"a": 2, "b": 1 + 2j},
{"a": 1, "b": 1 + 1j},
{"a": 1, "b": 1 + 2j},
]
)
result = df.groupby("b").mean()
expected = DataFrame(
[[1.0], [1.5]],
index=Index([(1 + 1j), (1 + 2j)], name="b"),
columns=Index(["a"]),
)
tm.assert_frame_equal(result, expected)


def test_groupby_complex_numbers(using_infer_string):
# GH 17927
df = DataFrame(
Expand Down

0 comments on commit e00a7bc

Please sign in to comment.