Skip to content

Slicing a dataframe for rows by set of index labels returns empty rows for missing labels, feature or bug? #2911

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

Closed
ruidc opened this issue Feb 21, 2013 · 4 comments
Labels
API Design Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves
Milestone

Comments

@ruidc
Copy link
Contributor

ruidc commented Feb 21, 2013

what is the best way to safely slice using multiple index labels? (i.e. not create new NaN rows?) is the best way to do this to intersect the index with the searched values before searching?

import pandas
df = pandas.DataFrame([[1,2], [3,4]], index=['X', 'Y'], columns=['A', 'B'])
df.ix[['X', 'Z'], :]

Out[1]: 
    A   B
X   1   2
Z NaN NaN    < -- why does this not error?
@jreback
Copy link
Contributor

jreback commented Mar 14, 2013

this is essentially a reindex, not intuitive, see #2922 and new docs for .loc, which have different semantics (and won't do this)

@michaelaye
Copy link
Contributor

That's a very meta comment, Jeff. ;) Not sure, I'm getting it...

@jreback
Copy link
Contributor

jreback commented Mar 15, 2013

my comment ? :)

or the issue?

@jreback
Copy link
Contributor

jreback commented Sep 21, 2013

dupe of #2033

@jreback jreback closed this as completed Sep 21, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

No branches or pull requests

3 participants