We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 41b77ca commit 56e0117Copy full SHA for 56e0117
pandas/tests/test_categorical.py
@@ -54,6 +54,24 @@ def test_getitem_listlike(self):
54
expected = c[np.array([100000]).astype(np.int64)].codes
55
self.assert_numpy_array_equal(result, expected)
56
57
+ def test_getitem_category_type(self):
58
+ # GH 14580
59
+ # test iloc() on Series with Categorical data
60
+
61
+ s = pd.Series([1, 2, 3]).astype('category')
62
63
+ # get slice
64
+ result = s.iloc[0:1]
65
+ self.assertEqual(type(result), type(s))
66
67
+ # get list of indexes
68
+ result = s.iloc[[0, 1]]
69
70
71
+ # get boolean array
72
+ result = s.iloc[[True, False, False]]
73
74
75
def test_setitem(self):
76
77
# int/positional
0 commit comments