Skip to content

Commit 0abde4a

Browse files
author
Khor Chean Wei
authored
Merge branch 'main' into enh-consistency-interval-range
2 parents 8967bc4 + 6033ed4 commit 0abde4a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/series/accessors/test_cat_accessor.py

+9
Original file line numberDiff line numberDiff line change
@@ -282,3 +282,12 @@ def test_set_categories_setitem(self):
282282
# values should not be coerced to NaN
283283
assert list(df["Sex"]) == ["female", "male", "male"]
284284
assert list(df["Survived"]) == ["Yes", "No", "Yes"]
285+
286+
def test_categorical_of_booleans_is_boolean(self):
287+
# https://github.com/pandas-dev/pandas/issues/46313
288+
df = DataFrame(
289+
{"int_cat": [1, 2, 3], "bool_cat": [True, False, False]}, dtype="category"
290+
)
291+
value = df["bool_cat"].cat.categories.dtype
292+
expected = np.dtype(np.bool_)
293+
assert value is expected

0 commit comments

Comments
 (0)