Skip to content

Commit d46091e

Browse files
committed
add FutureWarning. Avoid Int64Index
1 parent a9a63e7 commit d46091e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pandas/tests/groupby/aggregate/test_cython.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def test_cython_agg_nothing_to_agg():
9797

9898
frame = DataFrame({"a": np.random.randint(0, 5, 50), "b": ["foo", "bar"] * 25})
9999

100-
result = frame[["b"]].groupby(frame["a"]).mean()
100+
with tm.assert_produces_warning(FutureWarning, check_stacklevel=False):
101+
result = frame[["b"]].groupby(frame["a"]).mean()
101102
expected = DataFrame([], index=frame["a"].sort_values().drop_duplicates())
102103
tm.assert_frame_equal(result, expected)
103104

pandas/tests/groupby/test_groupby.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
DataFrame,
1515
Grouper,
1616
Index,
17-
Int64Index,
1817
MultiIndex,
1918
RangeIndex,
2019
Series,
@@ -2427,7 +2426,7 @@ def test_groupby_aggregation_multi_non_numeric_dtype():
24272426
"y": [Timedelta(i, "days") for i in range(7, 9)],
24282427
"z": [Timedelta(i * 10, "days") for i in range(7, 9)],
24292428
},
2430-
index=Int64Index([0, 1], dtype="int64", name="x"),
2429+
index=Index([0, 1], dtype="int64", name="x"),
24312430
)
24322431

24332432
gb = df.groupby(by=["x"])
@@ -2447,7 +2446,7 @@ def test_groupby_aggregation_numeric_with_non_numeric_dtype():
24472446

24482447
expected = DataFrame(
24492448
{"z": [7, 8]},
2450-
index=Int64Index([0, 1], dtype="int64", name="x"),
2449+
index=Index([0, 1], dtype="int64", name="x"),
24512450
)
24522451

24532452
gb = df.groupby(by=["x"])

0 commit comments

Comments
 (0)