diff --git a/dios/indexer.py b/dios/indexer.py index e7ac92f313f49616f7016fd5873aadcbbf5f5d9e..afe942545957a5def045c810fb6b600b75cd8ce5 100644 --- a/dios/indexer.py +++ b/dios/indexer.py @@ -311,7 +311,7 @@ class _aLocIndexer(_Indexer): # return a single Series, instead of a dios lowdim = False - # dios + # dios / df if _is_dios_like(key): colkey = self._dios.columns.intersection(key.columns) rowkey = [self._data.at[c].index.intersection(key[c].index) for c in colkey] @@ -331,14 +331,14 @@ class _aLocIndexer(_Indexer): # column-alignable: list-like, filter only existing columns elif _is_list_like_not_nested(colkey) and not _is_bool_indexer(colkey): colkey = colkey.values if isinstance(colkey, pd.Series) else colkey - colkey = [c for c in self._dios.columns if c in colkey] + colkey = self._dios.columns.intersection(colkey) # not alignable # fall back to .loc (boolean list/series, slice(..), ... else: colkey = self._data.loc[colkey].index - if not colkey: + if len(colkey) == 0: # (!) `if not colkey:` fails for pd.Index return [], [], lowdim #