Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions pandas/tests/test_categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down