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/7866 below:

bug in multi-index slicing with missing indexers · Issue #7866 · pandas-dev/pandas · GitHub

I think the following could work and not raise KeyError because of a missing indexer. This would follow the API of loc which will be effectively a reindex as long as you have at least 1 found value.

s = pd.Series(np.arange(9),index=pd.MultiIndex.from_product([['A','B','C'],['foo','bar','baz']],names=['one','two'])).sortlevel()

s.loc[['A','D']]

idx = pd.IndexSlice
s.loc[idx[:,['foo','bah']]]

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