Skip to content

Commit c8ad7fd

Browse files
authored
TYP: join.pyi (#40831)
1 parent c8e22f1 commit c8ad7fd

File tree

2 files changed

+159
-3
lines changed

2 files changed

+159
-3
lines changed

pandas/_libs/join.pyi

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
import numpy as np
2+
3+
def inner_join(
4+
left: np.ndarray, # const intp_t[:]
5+
right: np.ndarray, # const intp_t[:]
6+
max_groups: int,
7+
) -> tuple[
8+
np.ndarray, # np.ndarray[np.intp]
9+
np.ndarray, # np.ndarray[np.intp]
10+
]: ...
11+
12+
13+
def left_outer_join(
14+
left: np.ndarray, # const intp_t[:]
15+
right: np.ndarray, # const intp_t[:]
16+
max_groups: int,
17+
sort: bool = True,
18+
) -> tuple[
19+
np.ndarray, # np.ndarray[np.intp]
20+
np.ndarray, # np.ndarray[np.intp]
21+
]: ...
22+
23+
24+
def full_outer_join(
25+
left: np.ndarray, # const intp_t[:]
26+
right: np.ndarray, # const intp_t[:]
27+
max_groups: int,
28+
) -> tuple[
29+
np.ndarray, # np.ndarray[np.intp]
30+
np.ndarray, # np.ndarray[np.intp]
31+
]: ...
32+
33+
34+
def ffill_indexer(
35+
indexer: np.ndarray # const intp_t[:]
36+
) -> np.ndarray: ... # np.ndarray[np.intp]
37+
38+
39+
def left_join_indexer_unique(
40+
left: np.ndarray, # ndarray[join_t]
41+
right: np.ndarray, # ndarray[join_t]
42+
) -> np.ndarray: ... # np.ndarray[np.intp]
43+
44+
45+
def left_join_indexer(
46+
left: np.ndarray, # ndarray[join_t]
47+
right: np.ndarray, # ndarray[join_t]
48+
) -> tuple[
49+
np.ndarray, # np.ndarray[join_t]
50+
np.ndarray, # np.ndarray[np.intp]
51+
np.ndarray, # np.ndarray[np.intp]
52+
]: ...
53+
54+
55+
def inner_join_indexer(
56+
left: np.ndarray, # ndarray[join_t]
57+
right: np.ndarray, # ndarray[join_t]
58+
) -> tuple[
59+
np.ndarray, # np.ndarray[join_t]
60+
np.ndarray, # np.ndarray[np.intp]
61+
np.ndarray, # np.ndarray[np.intp]
62+
]: ...
63+
64+
65+
def outer_join_indexer(
66+
left: np.ndarray, # ndarray[join_t]
67+
right: np.ndarray, # ndarray[join_t]
68+
) -> tuple[
69+
np.ndarray, # np.ndarray[join_t]
70+
np.ndarray, # np.ndarray[np.intp]
71+
np.ndarray, # np.ndarray[np.intp]
72+
]: ...
73+
74+
75+
def asof_join_backward_on_X_by_Y(
76+
left_values: np.ndarray, # asof_t[:]
77+
right_values: np.ndarray, # asof_t[:]
78+
left_by_values: np.ndarray, # by_t[:]
79+
right_by_values: np.ndarray, # by_t[:]
80+
allow_exact_matches: bool = True,
81+
tolerance=None,
82+
) -> tuple[
83+
np.ndarray, # np.ndarray[np.intp]
84+
np.ndarray, # np.ndarray[np.intp]
85+
]: ...
86+
87+
88+
def asof_join_forward_on_X_by_Y(
89+
left_values: np.ndarray, # asof_t[:]
90+
right_values: np.ndarray, # asof_t[:]
91+
left_by_values: np.ndarray, # by_t[:]
92+
right_by_values: np.ndarray, # by_t[:]
93+
allow_exact_matches: bool = True,
94+
tolerance=None,
95+
) -> tuple[
96+
np.ndarray, # np.ndarray[np.intp]
97+
np.ndarray, # np.ndarray[np.intp]
98+
]: ...
99+
100+
101+
def asof_join_nearest_on_X_by_Y(
102+
left_values: np.ndarray, # asof_t[:]
103+
right_values: np.ndarray, # asof_t[:]
104+
left_by_values: np.ndarray, # by_t[:]
105+
right_by_values: np.ndarray, # by_t[:]
106+
allow_exact_matches: bool = True,
107+
tolerance=None,
108+
) -> tuple[
109+
np.ndarray, # np.ndarray[np.intp]
110+
np.ndarray, # np.ndarray[np.intp]
111+
]: ...
112+
113+
114+
def asof_join_backward(
115+
left_values: np.ndarray, # asof_t[:]
116+
right_values: np.ndarray, # asof_t[:]
117+
allow_exact_matches: bool = True,
118+
tolerance=None,
119+
) -> tuple[
120+
np.ndarray, # np.ndarray[np.intp]
121+
np.ndarray, # np.ndarray[np.intp]
122+
]: ...
123+
124+
125+
def asof_join_forward(
126+
left_values: np.ndarray, # asof_t[:]
127+
right_values: np.ndarray, # asof_t[:]
128+
allow_exact_matches: bool = True,
129+
tolerance=None,
130+
) -> tuple[
131+
np.ndarray, # np.ndarray[np.intp]
132+
np.ndarray, # np.ndarray[np.intp]
133+
]: ...
134+
135+
136+
def asof_join_nearest(
137+
left_values: np.ndarray, # asof_t[:]
138+
right_values: np.ndarray, # asof_t[:]
139+
allow_exact_matches: bool = True,
140+
tolerance=None,
141+
) -> tuple[
142+
np.ndarray, # np.ndarray[np.intp]
143+
np.ndarray, # np.ndarray[np.intp]
144+
]: ...

pandas/core/reshape/merge.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,7 +1485,8 @@ def get_join_indexers(
14851485
"outer": libjoin.full_outer_join,
14861486
}[how]
14871487

1488-
return join_func(lkey, rkey, count, **kwargs)
1488+
# error: Cannot call function of unknown type
1489+
return join_func(lkey, rkey, count, **kwargs) # type: ignore[operator]
14891490

14901491

14911492
def restore_dropped_levels_multijoin(
@@ -1624,9 +1625,20 @@ def get_result(self) -> DataFrame:
16241625
self.left._info_axis, self.right._info_axis, self.suffixes
16251626
)
16261627

1628+
left_join_indexer: np.ndarray | None
1629+
right_join_indexer: np.ndarray | None
1630+
16271631
if self.fill_method == "ffill":
1628-
left_join_indexer = libjoin.ffill_indexer(left_indexer)
1629-
right_join_indexer = libjoin.ffill_indexer(right_indexer)
1632+
# error: Argument 1 to "ffill_indexer" has incompatible type
1633+
# "Optional[ndarray]"; expected "ndarray"
1634+
left_join_indexer = libjoin.ffill_indexer(
1635+
left_indexer # type: ignore[arg-type]
1636+
)
1637+
# error: Argument 1 to "ffill_indexer" has incompatible type
1638+
# "Optional[ndarray]"; expected "ndarray"
1639+
right_join_indexer = libjoin.ffill_indexer(
1640+
right_indexer # type: ignore[arg-type]
1641+
)
16301642
else:
16311643
left_join_indexer = left_indexer
16321644
right_join_indexer = right_indexer

0 commit comments

Comments
 (0)