Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH1043 Update _typing.pyi: add "cross" option to JoinHow #1044

Merged
merged 6 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas-stubs/core/frame.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ class DataFrame(NDFrame, OpsMixin):
self,
other: DataFrame | Series | list[DataFrame | Series],
on: _str | list[_str] | None = ...,
how: JoinHow = ...,
how: MergeHow = ...,
lsuffix: _str = ...,
rsuffix: _str = ...,
sort: _bool = ...,
Expand Down
10 changes: 10 additions & 0 deletions tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2345,6 +2345,16 @@ def test_join() -> None:
check(assert_type(left.join(right, validate="1:m"), pd.DataFrame), pd.DataFrame)


def test_types_join() -> None:
df1 = pd.DataFrame({"A": [1, 2], "B": ["test", "test"]})
df2 = pd.DataFrame({"C": [2, 3], "D": ["test", "test"]})
check(assert_type(df1.join(df2, how="cross"), pd.DataFrame), pd.DataFrame)
check(assert_type(df1.join(df2, how="inner"), pd.DataFrame), pd.DataFrame)
check(assert_type(df1.join(df2, how="outer"), pd.DataFrame), pd.DataFrame)
check(assert_type(df1.join(df2, how="left"), pd.DataFrame), pd.DataFrame)
check(assert_type(df1.join(df2, how="right"), pd.DataFrame), pd.DataFrame)


def test_types_ffill() -> None:
# GH 44
df = pd.DataFrame([[1, 2, 3]])
Expand Down