Skip to content

Series/DataFrame lookup values behave inconsistently #11998

Closed
@yueatwork

Description

@yueatwork

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignDuplicate ReportDuplicate issue or pull requestIndexingRelated to indexing on series/frames, not to indexes themselves

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions