We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9379642 commit e00a7bcCopy full SHA for e00a7bc
pandas/tests/groupby/test_groupby.py
@@ -1196,6 +1196,24 @@ def test_groupby_complex():
1196
tm.assert_series_equal(result, expected)
1197
1198
1199
+def test_groupby_complex_mean():
1200
+ # GH 26475
1201
+ df = DataFrame(
1202
+ [
1203
+ {"a": 2, "b": 1 + 2j},
1204
+ {"a": 1, "b": 1 + 1j},
1205
+ {"a": 1, "b": 1 + 2j},
1206
+ ]
1207
+ )
1208
+ result = df.groupby("b").mean()
1209
+ expected = DataFrame(
1210
+ [[1.0], [1.5]],
1211
+ index=Index([(1 + 1j), (1 + 2j)], name="b"),
1212
+ columns=Index(["a"]),
1213
1214
+ tm.assert_frame_equal(result, expected)
1215
+
1216
1217
def test_groupby_complex_numbers(using_infer_string):
1218
# GH 17927
1219
df = DataFrame(
0 commit comments