(
self, other: Index, how: JoinHow = "left", sort: bool = False
)
| 4672 | |
| 4673 | @final |
| 4674 | def _join_non_unique( |
| 4675 | self, other: Index, how: JoinHow = "left", sort: bool = False |
| 4676 | ) -> tuple[Index, npt.NDArray[np.intp], npt.NDArray[np.intp]]: |
| 4677 | from pandas.core.reshape.merge import get_join_indexers_non_unique |
| 4678 | |
| 4679 | # We only get here if dtypes match |
| 4680 | assert self.dtype == other.dtype |
| 4681 | |
| 4682 | left_idx, right_idx = get_join_indexers_non_unique( |
| 4683 | self._values, other._values, how=how, sort=sort |
| 4684 | ) |
| 4685 | |
| 4686 | if how == "right": |
| 4687 | join_index = other.take(right_idx) |
| 4688 | else: |
| 4689 | join_index = self.take(left_idx) |
| 4690 | |
| 4691 | if how == "outer": |
| 4692 | mask = left_idx == -1 |
| 4693 | if mask.any(): |
| 4694 | right = other.take(right_idx) |
| 4695 | join_index = join_index.putmask(mask, right) |
| 4696 | |
| 4697 | if isinstance(join_index, ABCMultiIndex) and how == "outer": |
| 4698 | # test_join_index_levels |
| 4699 | join_index = join_index._sort_levels_monotonic() |
| 4700 | return join_index, left_idx, right_idx |
| 4701 | |
| 4702 | @final |
| 4703 | def _join_level( |
no test coverage detected