Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add a test to check zero index array do not error #25856

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
tm.assert_frame_equal(df.iloc[ar], df.iloc[0])
except TypeError:
pytest.fail("Unexpected TypeError, should be first element of array.")

class TestSeriesNoneCoercion(object):
EXPECTED_RESULTS = [
Expand Down