-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
.iloc with 1-element integer array behaves badly #5006
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
Comments
looks like a buglet, not treating the
fyi....this would be the preferred usage of what you are doing in any event
|
Thanks, but I have different use cases: I am often using .diff().nonzero() in order to find indices where relevant parameters change (e.g. an error code, depending on some input parameters). Otherwise, I am using boolean selections where possible. |
np.....pretty trivial fix, want to do a PR? |
I might have a look later (Monday), but I have to hurry and leave in < 5 minutes. ;-) |
gr8.....will leave open for you! |
@hmeine doing a PR for this? |
Did not forget about it, but did not yet get around to it, either. Is pandas/tests/test_indexing.py the right place for a regression test? Here's a holiday today, so I have four family days. Can't say yet whether that makes it harder or easier to find time for hacking. ;-) |
test_indexing is good for this |
There is an inconsistency in the returned (python) types when indexing .iloc with an integer array. The result should always be a sequence (Series), but if the array contains exactly one index, it returns a scalar value:
I am working around that using
numpy.atleast_1d
, but it's ugly.The text was updated successfully, but these errors were encountered: