Skip to content

Commit b35f16e

Browse files
author
Fariba Aalamifar
committed
add unit test for writeable flag after unique
1 parent 5a73752 commit b35f16e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

pandas/tests/test_categorical.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,6 +1227,10 @@ def test_set_categories(self):
12271227
exp_categories = Index(["a", "b", "c", "d"])
12281228
tm.assert_index_equal(cat.categories, exp_categories)
12291229

1230+
# all-nan categories GH 18051
1231+
cat_nan = Categorical([np.nan])
1232+
assert cat_nan.unique()._codes.flags.writeable
1233+
12301234
# internals...
12311235
c = Categorical([1, 2, 3, 4, 1], categories=[1, 2, 3, 4], ordered=True)
12321236
tm.assert_numpy_array_equal(c._codes, np.array([0, 1, 2, 3, 0],

0 commit comments

Comments
 (0)