From 14ffb61c9a099ef314fa41428e5a836f894a6cf0 Mon Sep 17 00:00:00 2001
From: Bert Palm <bert.palm@ufz.de>
Date: Thu, 12 Mar 2020 14:42:59 +0100
Subject: [PATCH] indexer bug fix

---
 dios/indexer.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/dios/indexer.py b/dios/indexer.py
index e7ac92f..afe9425 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
 
             #
-- 
GitLab