MCPcopy
hub / github.com/pandas-dev/pandas / _difference

Method _difference

pandas/core/indexes/base.py:3472–3481  ·  view source on GitHub ↗
(self, other, sort)

Source from the content-addressed store, hash-verified

3470 return self._wrap_difference_result(other, result)
3471
3472 def _difference(self, other, sort):
3473 # overridden by RangeIndex
3474 this = self
3475 if isinstance(self, ABCCategoricalIndex) and self.hasnans and other.hasnans:
3476 this = this.dropna()
3477 other = other.unique()
3478 the_diff = this[other.get_indexer_for(this) == -1]
3479 the_diff = the_diff if this.is_unique else the_diff.unique()
3480 the_diff = _maybe_try_sort(the_diff, sort)
3481 return the_diff
3482
3483 def _wrap_difference_result(self, other, result):
3484 # We will override for MultiIndex to handle empty results

Callers 1

differenceMethod · 0.95

Calls 4

_maybe_try_sortFunction · 0.85
get_indexer_forMethod · 0.80
dropnaMethod · 0.45
uniqueMethod · 0.45

Tested by

no test coverage detected