A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/7999 below:

Documentation/behaviour error for selecting by label · Issue #7999 · pandas-dev/pandas · GitHub

Skip to content Navigation Menu

Saved searches Use saved searches to filter your results more quickly

Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert Additional navigation options

Documentation/behaviour error for selecting by label #7999

Description
df = pandas.DataFrame([['a'], ['b']], index=[1,2], columns=['x'])
df.loc[[3]] # does not raise KeyError as documented

"ALL of the labels for which you ask, must be in the index or a KeyError will be raised!"
http://pandas.pydata.org/pandas-docs/stable/indexing.html#selection-by-label
and
".loc is strictly label based, will raise KeyError when the items are not found":
http://pandas.pydata.org/pandas-docs/stable/indexing.html#different-choices-for-indexing-loc-iloc-and-ix

also, possibly separate bug:

df.loc[pandas.Index(['a', 'k', 'b']), : ]

DOES fail, so we have an inconsistency between .loc[values,:] and .loc[values]

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4