-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
Series.drop() with boolean index: inconsistent behaviour #8530
Comments
feel free to submit a PR for 1) docs why would c) be incorrect? A value NOT in the axis by definition raises as an aside, using a fully boolean index by definition almost always has duplicates which makes it a bit tricky to work with it. |
#6599 is an attempt to consolidate the |
Thanks for your comments. My key point is that (b) and (c) are inconsistent in a way users would not expect. Personally, I find it convenient that errors are not raised in (b) but I suppose that it is most important that the behaviour be consistent. To change the behaviour so that (b) raises an error would have the advantage of making the behaviour consistent across all index types and lengths, perhaps making further documentation unnecessary. |
sorry, you are right. I think b) should raise, that looks like a bug (as I said before, just be careful with bool indexes). |
@urraca yes this stems from the fact that b) has a duplicate index, while c) does not. Have to think about this. |
This behavior is not present in 0.23.2 |
The behaviour below occurs in versions
'0.15.0rc1-21-g32c5016'
and'0.14.1'
.When the
label
passed to thedrop
method of aSeries
is not in the index:(a) if the index is not all booleans then an error is raised
(b) if the index is all booleans and has length > 1 then no error is raised; the original series is returned
(c) if the index is all booleans and has length == 1 then an error is raised
I propose that:
Examples of current behaviour:
(a)
(b)
(c)
The text was updated successfully, but these errors were encountered: