We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9ed8fe9 commit 2f8cd27Copy full SHA for 2f8cd27
pandas/core/indexing.py
@@ -15,7 +15,6 @@
15
is_numeric_dtype,
16
is_scalar,
17
is_sequence,
18
- is_sparse,
19
)
20
from pandas.core.dtypes.concat import concat_compat
21
from pandas.core.dtypes.generic import ABCDataFrame, ABCMultiIndex, ABCSeries
@@ -2230,9 +2229,9 @@ def check_bool_indexer(index: Index, key) -> np.ndarray:
2230
2229
2231
result = result.astype(bool)._values
2232
else:
2233
- if is_sparse(result):
2234
- result = np.asarray(result)
2235
- result = check_array_indexer(index, np.asarray(result, dtype=bool))
+ # key might be sparse / object-dtype bool, check_array_indexer needs bool array
+ result = np.asarray(result, dtype=bool)
+ result = check_array_indexer(index, result)
2236
2237
return result
2238
0 commit comments