We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 10ac3ea commit d3f94a4Copy full SHA for d3f94a4
pandas/core/arrays/categorical.py
@@ -39,7 +39,7 @@
39
)
40
from pandas.core.dtypes.dtypes import CategoricalDtype
41
from pandas.core.dtypes.generic import ABCIndexClass, ABCSeries
42
-from pandas.core.dtypes.inference import is_hashable
+from pandas.core.dtypes.inference import is_array_like, is_hashable
43
from pandas.core.dtypes.missing import isna, notna
44
45
from pandas.core import ops
@@ -1998,7 +1998,10 @@ def __getitem__(self, key):
1998
else:
1999
return self.categories[i]
2000
2001
- elif com.is_bool_indexer(key):
+ if is_list_like(key) and not is_array_like(key):
2002
+ key = np.asarray(key)
2003
+
2004
+ if com.is_bool_indexer(key):
2005
key = check_bool_array_indexer(self, key)
2006
2007
return self._constructor(
0 commit comments