Skip to content

Commit

Permalink
add a test to check zero index array do not error
Browse files Browse the repository at this point in the history
closes #21946
  • Loading branch information
illegalnumbers committed Mar 24, 2019
1 parent e31b4f4 commit 4dbf456
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pandas/tests/indexing/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,14 @@ def test_no_reference_cycle(self):
del df
assert wr() is None

def test_no_error_for_zero_index(self):
# GH-21946
df = DataFrame([[1, 2], [3, 4]], columns=['a', 'b'])
ar = np.array(0)
try:
assert df.iloc[ar].all() == df.iloc[0].all()
except TypeError:
pytest.fail("Unexpected TypeError, should be first element of array.")

class TestSeriesNoneCoercion(object):
EXPECTED_RESULTS = [
Expand Down

0 comments on commit 4dbf456

Please sign in to comment.