|
48 | 48 | DtypeObj, |
49 | 49 | F, |
50 | 50 | IgnoreRaise, |
| 51 | + Level, |
51 | 52 | Shape, |
52 | 53 | npt, |
53 | 54 | ) |
@@ -4529,16 +4530,53 @@ def _reindex_non_unique( |
4529 | 4530 | # -------------------------------------------------------------------- |
4530 | 4531 | # Join Methods |
4531 | 4532 |
|
| 4533 | + @overload |
| 4534 | + def join( |
| 4535 | + self, |
| 4536 | + other: Index, |
| 4537 | + *, |
| 4538 | + how: str_t = ..., |
| 4539 | + level: Level = ..., |
| 4540 | + return_indexers: Literal[True], |
| 4541 | + sort: bool = ..., |
| 4542 | + ) -> tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]: |
| 4543 | + ... |
| 4544 | + |
| 4545 | + @overload |
| 4546 | + def join( |
| 4547 | + self, |
| 4548 | + other: Index, |
| 4549 | + *, |
| 4550 | + how: str_t = ..., |
| 4551 | + level: Level = ..., |
| 4552 | + return_indexers: Literal[False] = ..., |
| 4553 | + sort: bool = ..., |
| 4554 | + ) -> Index: |
| 4555 | + ... |
| 4556 | + |
| 4557 | + @overload |
| 4558 | + def join( |
| 4559 | + self, |
| 4560 | + other: Index, |
| 4561 | + *, |
| 4562 | + how: str_t = ..., |
| 4563 | + level: Level = ..., |
| 4564 | + return_indexers: bool = ..., |
| 4565 | + sort: bool = ..., |
| 4566 | + ) -> Index | tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]: |
| 4567 | + ... |
| 4568 | + |
4532 | 4569 | @final |
| 4570 | + @deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "other"]) |
4533 | 4571 | @_maybe_return_indexers |
4534 | 4572 | def join( |
4535 | 4573 | self, |
4536 | | - other, |
| 4574 | + other: Index, |
4537 | 4575 | how: str_t = "left", |
4538 | | - level=None, |
| 4576 | + level: Level = None, |
4539 | 4577 | return_indexers: bool = False, |
4540 | 4578 | sort: bool = False, |
4541 | | - ): |
| 4579 | + ) -> Index | tuple[Index, npt.NDArray[np.intp] | None, npt.NDArray[np.intp] | None]: |
4542 | 4580 | """ |
4543 | 4581 | Compute join_index and indexers to conform data |
4544 | 4582 | structures to the new index. |
@@ -4723,16 +4761,24 @@ def _join_multi(self, other: Index, how: str_t): |
4723 | 4761 | # Join left and right |
4724 | 4762 | # Join on same leveled multi-index frames is supported |
4725 | 4763 | join_idx, lidx, ridx = self_jnlevels.join( |
4726 | | - other_jnlevels, how, return_indexers=True |
| 4764 | + other_jnlevels, how=how, return_indexers=True |
4727 | 4765 | ) |
4728 | 4766 |
|
4729 | 4767 | # Restore the dropped levels |
4730 | 4768 | # Returned index level order is |
4731 | 4769 | # common levels, ldrop_names, rdrop_names |
4732 | 4770 | dropped_names = ldrop_names + rdrop_names |
4733 | 4771 |
|
| 4772 | + # error: Argument 5/6 to "restore_dropped_levels_multijoin" has |
| 4773 | + # incompatible type "Optional[ndarray[Any, dtype[signedinteger[Any |
| 4774 | + # ]]]]"; expected "ndarray[Any, dtype[signedinteger[Any]]]" |
4734 | 4775 | levels, codes, names = restore_dropped_levels_multijoin( |
4735 | | - self, other, dropped_names, join_idx, lidx, ridx |
| 4776 | + self, |
| 4777 | + other, |
| 4778 | + dropped_names, |
| 4779 | + join_idx, |
| 4780 | + lidx, # type: ignore[arg-type] |
| 4781 | + ridx, # type: ignore[arg-type] |
4736 | 4782 | ) |
4737 | 4783 |
|
4738 | 4784 | # Re-create the multi-index |
|
0 commit comments