-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Can't slice float indices, but can slice integer indices? #7501
Comments
Is this supposed to act like loc or ix, or something else? Behaviour of |
|
In which case, this is a bug. |
If you're suggesting slicing by rows is undesirable, what is the new way to do that? |
You should use |
@mrjbq7 You are slicing the columns
or |
@jreback the |
@jreback he's slicing the rows |
Okay, I can use |
it's definitely a bug, probably introduced by the small (ish) refactoring of |
|
though their is a bug their somewhere, @cpcloud ? |
on it 😄 |
P.S. you guys are awesomely responsive. Thanks. |
So slicing in [] as |
no if the labels are there, then it will use |
That does not seem to be the case:
|
huh. guess im wrong then, imho this style of indexing should be banned for life |
It's old syntax, which has worked in my application for several pandas versions and I only noticed just now that it was strangely not working. |
this was a change in 0.14 ... i refactored some of the "guessing" code and didn't catch this case |
|
So the bug is that the FloatIndex is not doing this location based slicing but tries label-based? (which is more logical, but inconsistent with the other indexers) @jreback it's not like
|
@jorisvandenbossche i'm glad you found this, except that now we have 4th style of indexing to support .... :) |
hmm, by definition on |
so we have
there's a strangely beautiful symmetry to this mess |
I believe most of the oddness was fixed in 0.18.0 for the float slicing fixup. so going to revisit this. |
@jreback What do you mean with 'revisit'? I don't think anything has changed to the original issue here ([] being label based for FloatIndex, while location based for IntIndex) |
no, some of the 'other' issues are fixed (IOW, the slicing is all now consistent), e.g.
|
we should prob close this issue and open a new clarifying issue about what the problems are with FloatIndex slicing. |
can someone parse this issue and see if we should open an issue w.r.t. float slicing? |
The original reported 'issue' is still present (or better: 'debatable behaviour') To summarize in a specific way (disregarding the .ix part of the above discussion, as that is deprecated anyway): for all index types, using integers in I think it would be nice to make int index and float index consistent for |
Pushing this off 1.0. |
Looks like it's been opened here #31344 |
Reading over this thread I was briefly optimistic "with ix gone this might be easier!" but nope
I agree with @jorisvandenbossche here. I'd also be on board with a "nuke it from space" option to deprecate the ambiguous behaviors |
Using pandas 0.14, the slicing changed strangely. I can slice rows using start/end with an integer index, but not a float index:
Was this an intentional change, or a bug?
The text was updated successfully, but these errors were encountered: