Skip to content

Commit 8d4c9a1

Browse files
committed
CLN: remove redundant comment, and name series as s
1 parent b8acbde commit 8d4c9a1

File tree

2 files changed

+12
-26
lines changed

2 files changed

+12
-26
lines changed

pandas/tests/indexing/test_iloc.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -676,22 +676,15 @@ def test_identity_slice_returns_new_object(self):
676676
original_series[:3] = [7, 8, 9]
677677
assert all(sliced_series[:3] == [7, 8, 9])
678678

679-
def test_indexing_zero_dim_np_array(self):
679+
def test_indexing_zerodim_np_array(self):
680680
# GH24919
681681
df = DataFrame([[1, 2], [3, 4]])
682-
683-
# should not raise an error
684682
result = df.iloc[np.array(0)]
683+
s = pd.Series([1, 2], name=0)
684+
tm.assert_series_equal(result, s)
685685

686-
# expected series
687-
sr = pd.Series([1, 2], name=0)
688-
tm.assert_series_equal(result, sr)
689-
690-
def test_series_indexing_zero_dim_np_array(self):
686+
def test_series_indexing_zerodim_np_array(self):
691687
# GH24919
692-
sr = Series([1, 2])
693-
694-
# should not raise an error
695-
result = sr.iloc[np.array(0)]
696-
688+
s = Series([1, 2])
689+
result = s.iloc[np.array(0)]
697690
assert result == 1

pandas/tests/indexing/test_loc.py

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -766,22 +766,15 @@ def test_loc_setitem_empty_append_raises(self):
766766
with pytest.raises(ValueError, match=msg):
767767
df.loc[0:2, 'x'] = data
768768

769-
def test_indexing_zero_dim_np_array(self):
769+
def test_indexing_zerodim_np_array(self):
770770
# GH24924
771771
df = DataFrame([[1, 2], [3, 4]])
772-
773-
# should not raise an error
774772
result = df.loc[np.array(0)]
773+
s = pd.Series([1, 2], name=0)
774+
tm.assert_series_equal(result, s)
775775

776-
# expected series
777-
sr = pd.Series([1, 2], name=0)
778-
tm.assert_series_equal(result, sr)
779-
780-
def test_series_indexing_zero_dim_np_array(self):
776+
def test_series_indexing_zerodim_np_array(self):
781777
# GH24924
782-
sr = Series([1, 2])
783-
784-
# should not raise an error
785-
result = sr.loc[np.array(0)]
786-
778+
s = Series([1, 2])
779+
result = s.loc[np.array(0)]
787780
assert result == 1

0 commit comments

Comments
 (0)