Skip to content

Fix: AttributeError when using .iloc with pyarrow-backed Series in Pandas #61311 #61321

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Shyanil
Copy link

@Shyanil Shyanil commented Apr 20, 2025

fix : #61311

Solution:

The problem arises when the code tries to access .max() and .min() on ArrowExtensionArray. To fix this, we can replace .max() and .min() with np.max() and np.min(), which can handle these arrays correctly.

Here is the modification to be made:

# check that the key does not exceed the maximum size of the index
if np.max(arr) >= len_axis or np.min(arr) < -len_axis:
    raise IndexError("positional indexers are out-of-bounds")

@Shyanil Shyanil closed this Apr 21, 2025
@Shyanil Shyanil reopened this Apr 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: 'ArrowExtensionArray' object has no attribute 'max' when passing pyarrow-backed series to .iloc
1 participant