Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.4.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Fixed regressions
Bug fixes
~~~~~~~~~
- Fixed segfault in :meth:``DataFrame.to_json`` when dumping tz-aware datetimes in Python 3.10 (:issue:`42130`)
-
- Bug in :meth:`common.is_bool_dtype` was raising an AttributeError when evaluating a categorical Series (:issue:`45615`)

.. ---------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
return False

if isinstance(dtype, CategoricalDtype):
arr_or_dtype = arr_or_dtype.categories
arr_or_dtype = dtype.categories
# now we use the special definition for Index

if isinstance(arr_or_dtype, ABCIndex):
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/dtypes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,7 @@ def test_is_bool_dtype():
assert not com.is_bool_dtype(int)
assert not com.is_bool_dtype(str)
assert not com.is_bool_dtype(pd.Series([1, 2]))
assert not com.is_bool_dtype(pd.Series(["a", "b"], dtype="category"))
assert not com.is_bool_dtype(np.array(["a", "b"]))
assert not com.is_bool_dtype(pd.Index(["a", "b"]))
assert not com.is_bool_dtype("Int64")
Expand Down