Skip to content

Commit 514b69c

Browse files
committed
Fix more tests
1 parent 7382f3d commit 514b69c

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

pandas/tests/frame/test_reductions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,8 +707,8 @@ def test_mode_sortwarning(self, using_infer_string):
707707

708708
def test_mode_empty_df(self):
709709
df = DataFrame([], columns=["a", "b"])
710+
expected = df.copy()
710711
result = df.mode()
711-
expected = DataFrame([], columns=["a", "b"], index=Index([], dtype=np.int64))
712712
tm.assert_frame_equal(result, expected)
713713

714714
def test_operators_timedelta64(self):
@@ -769,7 +769,7 @@ def test_operators_timedelta64(self):
769769

770770
# excludes non-numeric
771771
result = mixed.min(axis=1, numeric_only=True)
772-
expected = Series([1, 1, 1.0], index=[0, 1, 2])
772+
expected = Series([1, 1, 1.0])
773773
tm.assert_series_equal(result, expected)
774774

775775
# works when only those columns are selected

pandas/tests/groupby/test_groupby.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ def test_groupby_level_nonmulti():
858858
def test_groupby_complex():
859859
# GH 12902
860860
a = Series(data=np.arange(4) * (1 + 2j), index=[0, 0, 1, 1])
861-
expected = Series((1 + 2j, 5 + 10j))
861+
expected = Series((1 + 2j, 5 + 10j), index=Index([0, 1]))
862862

863863
result = a.groupby(level=0).sum()
864864
tm.assert_series_equal(result, expected)
@@ -1203,7 +1203,10 @@ def test_groupby_nat_exclude():
12031203
)
12041204
grouped = df.groupby("dt")
12051205

1206-
expected = [Index([1, 7]), Index([3, 5])]
1206+
expected = [
1207+
RangeIndex(start=1, stop=13, step=6),
1208+
RangeIndex(start=3, stop=7, step=2),
1209+
]
12071210
keys = sorted(grouped.groups.keys())
12081211
assert len(keys) == 2
12091212
for k, e in zip(keys, expected):
@@ -2663,7 +2666,9 @@ def test_groupby_method_drop_na(method):
26632666
Series(["a", "b", "c"], name="A")
26642667
)
26652668
else:
2666-
expected = DataFrame({"A": ["a", "b", "c"], "B": [0, 2, 4]}, index=[0, 2, 4])
2669+
expected = DataFrame(
2670+
{"A": ["a", "b", "c"], "B": [0, 2, 4]}, index=range(0, 6, 2)
2671+
)
26672672
tm.assert_frame_equal(result, expected)
26682673

26692674

pandas/tests/indexing/test_indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def test_loc_range_in_series_indexing(self, size):
783783
tm.assert_series_equal(s.loc[range(1)], Series(42.0, index=[0]))
784784

785785
s.loc[range(2)] = 43
786-
tm.assert_series_equal(s.loc[range(2)], Series(43.0, index=[0, 1]))
786+
tm.assert_series_equal(s.loc[range(2)], Series(43.0, index=range(2)))
787787

788788
def test_partial_boolean_frame_indexing(self):
789789
# GH 17170

0 commit comments

Comments
 (0)