-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Update join docs for other param #46850
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
Merged
+17
−4
Merged
Changes from 19 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
22c54af
Update join docs for other param
multimeric 36eec5b
Update type for _join_compat
multimeric 48048db
Allow any iterable for join; test join for a list of series
multimeric 7811306
Update type signature
multimeric bb002f8
Update pd.concat type, add cast() to make frame.join() work with mypy
multimeric 436f5d3
Fix type union syntax
multimeric 76ead79
NDFrame
multimeric b12f42e
Remove cast
multimeric e3c1fd3
Merge branch 'main' of github.com:pandas-dev/pandas into multimeric-p…
multimeric 3b04d62
Fix mypy errors
multimeric f72bbdd
Merge branch 'main' of github.com:pandas-dev/pandas into multimeric-p…
multimeric 7c1c113
Merge branch 'main' of github.com:pandas-dev/pandas into multimeric-p…
multimeric 0a241c0
Code review
multimeric e83bace
Merge branch 'main' of github.com:pandas-dev/pandas into multimeric-p…
multimeric f72a5b5
Remove unnecessary assert
multimeric 6d17dc9
Merge branch 'main' of github.com:pandas-dev/pandas into multimeric-p…
multimeric 75436c8
Add comment explaining the cast
multimeric f48213f
Fix swapped order of cast comment
multimeric b79e66c
Remove full stop
multimeric 4ba0ce0
Update pandas/core/frame.py
datapythonista File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9788,7 +9788,7 @@ def _append( | |
|
||
def join( | ||
self, | ||
other: DataFrame | Series, | ||
other: DataFrame | Series | list[DataFrame | Series], | ||
on: IndexLabel | None = None, | ||
how: str = "left", | ||
lsuffix: str = "", | ||
|
@@ -9805,7 +9805,8 @@ def join( | |
|
||
Parameters | ||
---------- | ||
other : DataFrame, Series, or list of DataFrame | ||
other : DataFrame, Series, or a list containing any combination of DataFrames | ||
and Series | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it now; the linter is complaining about the "and" being lowercase as if it's the start the description. I'd hazard a guess that sphinx does too. I think we should make the type more consise:
datapythonista marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Index should be similar to one of the columns in this one. If a | ||
Series is passed, its name attribute must be set, and that will be | ||
used as the column name in the resulting joined DataFrame. | ||
|
@@ -9961,7 +9962,7 @@ def join( | |
|
||
def _join_compat( | ||
self, | ||
other: DataFrame | Series, | ||
other: DataFrame | Series | Iterable[DataFrame | Series], | ||
on: IndexLabel | None = None, | ||
how: str = "left", | ||
lsuffix: str = "", | ||
|
@@ -10010,7 +10011,11 @@ def _join_compat( | |
"Suffixes not supported when joining multiple DataFrames" | ||
) | ||
|
||
frames = [self] + list(other) | ||
# Mypy thinks the RHS is a | ||
# "Union[DataFrame, Series, Iterable[Union[DataFrame, Series]]]" whereas | ||
# the LHS is an "Iterable[DataFrame]", but in reality both types are | ||
# "Iterable[Union[DataFrame, Series]]" due to the if statements | ||
multimeric marked this conversation as resolved.
Show resolved
Hide resolved
|
||
frames = [cast("DataFrame | Series", self)] + list(other) | ||
multimeric marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
can_concat = all(df.index.is_unique for df in frames) | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.