-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
ERR: Raise a better error for numpy singletons in Index #33026
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
Conversation
elif data is None or is_scalar(data): | ||
raise cls._scalar_data_error(data) | ||
elif hasattr(data, "__array__"): | ||
return Index(np.asarray(data), dtype=dtype, copy=copy, name=name, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking for scalars before testing for an __array__
attribute since things like np.array([1, 2])[0]
pass both
lgtm - can you add a whatsnew? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry one more nit otherwise lgtm
Co-Authored-By: William Ayd <[email protected]>
thanks @dsaxton |
Many thanks! That was a quick fix! :) |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff