Skip to content

Commit 808bff4

Browse files
move and change name
1 parent e917385 commit 808bff4

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

pandas/tests/groupby/test_groupby.py

+15-13
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,6 @@ def test_basic_aggregations(dtype):
136136
grouped.aggregate(lambda x: x * 2)
137137

138138

139-
def test_groupby_complex_numbers():
140-
df = DataFrame([
141-
{"a": 2, "b": 1 + 2j},
142-
{"a": 1, "b": 1 + 1j},
143-
{"a": 1, "b": 1 + 2j},
144-
])
145-
assert df.groupby("b").groups == {(1 + 1j): [1], (1 + 2j): [0, 2]}
146-
tm.assert_frame_equal(
147-
df.groupby("b").mean(),
148-
DataFrame({"a": {(1 + 1j): 1.0, (1 + 2j): 1.5}}),
149-
)
150-
151-
152139
def test_groupby_nonobject_dtype(multiindex_dataframe_random_data):
153140
key = multiindex_dataframe_random_data.index.codes[0]
154141
grouped = multiindex_dataframe_random_data.groupby(key)
@@ -1209,6 +1196,21 @@ def test_groupby_complex():
12091196
tm.assert_series_equal(result, expected)
12101197

12111198

1199+
def test_groupby_complex_2():
1200+
df = DataFrame(
1201+
[
1202+
{"a": 2, "b": 1 + 2j},
1203+
{"a": 1, "b": 1 + 1j},
1204+
{"a": 1, "b": 1 + 2j},
1205+
]
1206+
)
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}}),
1211+
)
1212+
1213+
12121214
def test_groupby_complex_numbers(using_infer_string):
12131215
# GH 17927
12141216
df = DataFrame(

0 commit comments

Comments
 (0)