File tree 1 file changed +8
-5
lines changed
1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1196,19 +1196,22 @@ def test_groupby_complex():
1196
1196
tm .assert_series_equal (result , expected )
1197
1197
1198
1198
1199
- def test_groupby_complex_2 ():
1199
+ def test_groupby_complex_mean ():
1200
+ # GH 26475
1200
1201
df = DataFrame (
1201
1202
[
1202
1203
{"a" : 2 , "b" : 1 + 2j },
1203
1204
{"a" : 1 , "b" : 1 + 1j },
1204
1205
{"a" : 1 , "b" : 1 + 2j },
1205
1206
]
1206
1207
)
1207
- assert df .groupby ("b" ).groups == {(1 + 1j ): [1 ], (1 + 2j ): [0 , 2 ]}
1208
- tm .assert_frame_equal (
1209
- df .groupby ("b" ).mean (),
1210
- DataFrame ({"a" : {(1 + 1j ): 1.0 , (1 + 2j ): 1.5 }}),
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" ]),
1211
1213
)
1214
+ tm .assert_frame_equal (result , expected )
1212
1215
1213
1216
1214
1217
def test_groupby_complex_numbers (using_infer_string ):
You can’t perform that action at this time.
0 commit comments