We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5067708 commit c9cd901Copy full SHA for c9cd901
pandas/indexes/base.py
@@ -2085,15 +2085,15 @@ def intersection(self, other):
2085
pass
2086
2087
try:
2088
- indexer = Index(self._values).get_indexer(other._values)
+ indexer = Index(other._values).get_indexer(self._values)
2089
indexer = indexer.take((indexer != -1).nonzero()[0])
2090
except:
2091
# duplicates
2092
- indexer = Index(self._values).get_indexer_non_unique(
2093
- other._values)[0].unique()
+ indexer = Index(other._values).get_indexer_non_unique(
+ self._values)[0].unique()
2094
indexer = indexer[indexer != -1]
2095
2096
- taken = self.take(indexer)
+ taken = other.take(indexer)
2097
if self.name != other.name:
2098
taken.name = None
2099
return taken
0 commit comments