def difference(self, other, sort=None):
        self._validate_sort_keyword(sort)
        self._assert_can_do_setop(other)
        if self.equals(other):
            return self._shallow_copy(self._data[:0])
        other, result_name = self._convert_can_do_setop(other)
        this = self._get_unique_index()
        indexer = this.get_indexer(other)
        indexer = indexer.take((indexer != -1).nonzero()[0])
        label_diff = np.setdiff1d(np.arange(this.size), indexer,
                                  assume_unique=True)
        the_diff = this.values.take(label_diff)
        if sort is None:
            try:
                the_diff = sorting.safe_sort(the_diff)
            except TypeError:
                pass
        return this._shallow_copy(the_diff, name=result_name, freq=None)