Skip to content

Commit 4e9185b

Browse files
topper-123jbrockmendel
authored andcommitted
minor cleanups (pandas-dev#29798)
1 parent 5436ccd commit 4e9185b

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

doc/source/whatsnew/v1.0.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ Performance improvements
426426
- Performance improvement in :meth:`DataFrame.replace` when provided a list of values to replace (:issue:`28099`)
427427
- Performance improvement in :meth:`DataFrame.select_dtypes` by using vectorization instead of iterating over a loop (:issue:`28317`)
428428
- Performance improvement in :meth:`Categorical.searchsorted` and :meth:`CategoricalIndex.searchsorted` (:issue:`28795`)
429-
- Performance improvement when searching for a scalar in a :meth:`Categorical` and the scalar is not found in the categories (:issue:`29750`)
429+
- Performance improvement when comparing a :meth:`Categorical` with a scalar and the scalar is not found in the categories (:issue:`29750`)
430430

431431
.. _whatsnew_1000.bug_fixes:
432432

pandas/core/arrays/categorical.py

+2-8
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@ def _cat_compare_op(op):
7777

7878
@unpack_zerodim_and_defer(opname)
7979
def func(self, other):
80-
# On python2, you can usually compare any type to any type, and
81-
# Categoricals can be seen as a custom type, but having different
82-
# results depending whether categories are the same or not is kind of
83-
# insane, so be a bit stricter here and use the python3 idea of
84-
# comparing only things of equal type.
85-
8680
if is_list_like(other) and len(other) != len(self):
8781
# TODO: Could this fail if the categories are listlike objects?
8882
raise ValueError("Lengths must match.")
@@ -840,8 +834,8 @@ def set_categories(self, new_categories, ordered=None, rename=False, inplace=Fal
840834
On the other hand this methods does not do checks (e.g., whether the
841835
old categories are included in the new categories on a reorder), which
842836
can result in surprising changes, for example when using special string
843-
dtypes on python3, which does not considers a S1 string equal to a
844-
single char python string.
837+
dtypes, which does not considers a S1 string equal to a single char
838+
python string.
845839
846840
Parameters
847841
----------

0 commit comments

Comments
 (0)