Skip to content

Series/DataFrame lookup values behave inconsistently #11998

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
yueatwork opened this issue Jan 8, 2016 · 3 comments
Closed

Series/DataFrame lookup values behave inconsistently #11998

yueatwork opened this issue Jan 8, 2016 · 3 comments
Labels
API Design Duplicate Report Duplicate issue or pull request Indexing Related to indexing on series/frames, not to indexes themselves

Comments

@yueatwork
Copy link

One feature about DataFrame that I found uncomfortable is the inconsistency of results:

x = pd.DataFrame({'A': [1,2,3,4,5]}, index=['a','b','c','d','e'])
x.loc[['a', 'f']]  # fine, value of 'f' is numpy.nan
x.loc[['f']]  # throws 

When developing data applications, I spend lot of time fixing this issue. I think we should make it more consistent. Either always returns (preferred) or always throws.

@jreback
Copy link
Contributor

jreback commented Jan 8, 2016

duplicate of #10695

lots of discussion there.

@jreback jreback closed this as completed Jan 8, 2016
@jreback jreback added Indexing Related to indexing on series/frames, not to indexes themselves API Design Duplicate Report Duplicate issue or pull request labels Jan 8, 2016
@jreback
Copy link
Contributor

jreback commented Jan 8, 2016

this has nothing to do with Series/DataFrame, they both work the same. rather whether a single missing label raises, while a list that includes at least one label will be like a .reindex

@yueatwork
Copy link
Author

Thank you. Seems this isn't an easy fix. I will stick with the current framework until I figure out a better design.

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

2 participants