File tree Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Expand file tree Collapse file tree 3 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Bug fixes
3131- Fixed segfault in :meth: ``DataFrame.to_json` ` when dumping tz-aware datetimes in Python 3.10 (:issue: `42130 `)
3232- Stopped emitting unnecessary ``FutureWarning `` in :meth: `DataFrame.sort_values ` with sparse columns (:issue: `45618 `)
3333- 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 `)
3535
3636.. ---------------------------------------------------------------------------
3737
Original file line number Diff line number Diff line change @@ -1319,7 +1319,7 @@ def is_bool_dtype(arr_or_dtype) -> bool:
13191319 return False
13201320
13211321 if isinstance (dtype , CategoricalDtype ):
1322- arr_or_dtype = arr_or_dtype .categories
1322+ arr_or_dtype = dtype .categories
13231323 # now we use the special definition for Index
13241324
13251325 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():
562562 assert not com .is_bool_dtype (int )
563563 assert not com .is_bool_dtype (str )
564564 assert not com .is_bool_dtype (pd .Series ([1 , 2 ]))
565+ assert not com .is_bool_dtype (pd .Series (["a" , "b" ], dtype = "category" ))
565566 assert not com .is_bool_dtype (np .array (["a" , "b" ]))
566567 assert not com .is_bool_dtype (pd .Index (["a" , "b" ]))
567568 assert not com .is_bool_dtype ("Int64" )
568569
569570 assert com .is_bool_dtype (bool )
570571 assert com .is_bool_dtype (np .bool_ )
572+ assert com .is_bool_dtype (pd .Series ([True , False ], dtype = "category" ))
571573 assert com .is_bool_dtype (np .array ([True , False ]))
572574 assert com .is_bool_dtype (pd .Index ([True , False ]))
573575
You can’t perform that action at this time.
0 commit comments