diff --git a/pandas/core/categorical.py b/pandas/core/categorical.py index d404601bcafa1..d2708890c5ec2 100644 --- a/pandas/core/categorical.py +++ b/pandas/core/categorical.py @@ -726,6 +726,9 @@ def T(self): def nbytes(self): return self._codes.nbytes + self._categories.values.nbytes + def searchsorted(self, v, side='left', sorter=None): + raise NotImplementedError("See https://github.com/pydata/pandas/issues/8420") + def isnull(self): """ Detect missing values diff --git a/pandas/tests/test_categorical.py b/pandas/tests/test_categorical.py index d4cf687486cfb..e05d7285592aa 100644 --- a/pandas/tests/test_categorical.py +++ b/pandas/tests/test_categorical.py @@ -889,6 +889,15 @@ def test_nbytes(self): exp = cat._codes.nbytes + cat._categories.values.nbytes self.assertEqual(cat.nbytes, exp) + def test_searchsorted(self): + + # See https://github.com/pydata/pandas/issues/8420 + # TODO: implement me... + cat = pd.Categorical([1,2,3]) + def f(): + cat.searchsorted(3) + self.assertRaises(NotImplementedError, f) + def test_deprecated_labels(self): # TODO: labels is deprecated and should be removed in 0.18 or 2017, whatever is earlier cat = pd.Categorical([1,2,3, np.nan], categories=[1,2,3])