File tree 3 files changed +4
-2
lines changed
3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Bug fixes
31
31
- Fixed segfault in :meth: ``DataFrame.to_json` ` when dumping tz-aware datetimes in Python 3.10 (:issue: `42130 `)
32
32
- Stopped emitting unnecessary ``FutureWarning `` in :meth: `DataFrame.sort_values ` with sparse columns (:issue: `45618 `)
33
33
- Fixed window aggregations in :meth: `DataFrame.rolling ` and :meth: `Series.rolling ` to skip over unused elements (:issue: `45647 `)
34
- -
34
+ - Bug in :func: ` api.types.is_bool_dtype ` was raising an `` AttributeError `` when evaluating a categorical :class: ` Series ` ( :issue: ` 45615 `)
35
35
36
36
.. ---------------------------------------------------------------------------
37
37
Original file line number Diff line number Diff line change @@ -1319,7 +1319,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
1319
1319
return False
1320
1320
1321
1321
if isinstance (dtype , CategoricalDtype ):
1322
- arr_or_dtype = arr_or_dtype .categories
1322
+ arr_or_dtype = dtype .categories
1323
1323
# now we use the special definition for Index
1324
1324
1325
1325
if isinstance (arr_or_dtype , ABCIndex ):
Original file line number Diff line number Diff line change @@ -562,12 +562,14 @@ def test_is_bool_dtype():
562
562
assert not com .is_bool_dtype (int )
563
563
assert not com .is_bool_dtype (str )
564
564
assert not com .is_bool_dtype (pd .Series ([1 , 2 ]))
565
+ assert not com .is_bool_dtype (pd .Series (["a" , "b" ], dtype = "category" ))
565
566
assert not com .is_bool_dtype (np .array (["a" , "b" ]))
566
567
assert not com .is_bool_dtype (pd .Index (["a" , "b" ]))
567
568
assert not com .is_bool_dtype ("Int64" )
568
569
569
570
assert com .is_bool_dtype (bool )
570
571
assert com .is_bool_dtype (np .bool_ )
572
+ assert com .is_bool_dtype (pd .Series ([True , False ], dtype = "category" ))
571
573
assert com .is_bool_dtype (np .array ([True , False ]))
572
574
assert com .is_bool_dtype (pd .Index ([True , False ]))
573
575
You can’t perform that action at this time.
0 commit comments