-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: 27453 right merge order #31278
Merged
jreback
merged 15 commits into
pandas-dev:master
from
MarcoGorelli:27453-right-merge-order
Mar 26, 2020
Merged
BUG: 27453 right merge order #31278
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f81c4ee
add failing test to check row order preservation
25f7e03
:twisted_rightwards_arrows: fix conflicts, fix nameerror in tests
a53cc22
:pencil: add whatsnew entry to v1.0.1
2d77a5c
pass to _factorize_keys
bab654e
Add tests with merging on index, using original OP's example as test
714f5b4
fix whatsnew ipython directive
ff236a8
Merge branch 'master' into 27453-right-merge-order
MarcoGorelli d7e2db9
Merge remote-tracking branch 'upstream/master' into 27453-right-merge…
MarcoGorelli c83f46f
Add docstring and types
MarcoGorelli 65c3226
remove unnecessary test, remove test that doesn't fail on master
MarcoGorelli 0e2c529
Add docstring
MarcoGorelli 0cc79a9
Merge remote-tracking branch 'upstream/master' into 27453-right-merge…
MarcoGorelli 711d37c
use cast in categorical case
MarcoGorelli 511dade
Merge remote-tracking branch 'upstream/master' into 27453-right-merge…
MarcoGorelli aaf542e
reword titles in whatsnew (v1.0.x -> previous behavior)
MarcoGorelli 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 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 |
---|---|---|
|
@@ -168,6 +168,32 @@ key and type of :class:`Index`. These now consistently raise ``KeyError`` (:iss | |
... | ||
KeyError: Timestamp('1970-01-01 00:00:00') | ||
|
||
:meth:`DataFrame.merge` preserves right frame's row order | ||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
:meth:`DataFrame.merge` now preserves right frame's row order when executing a right merge (:issue:`27453`) | ||
|
||
.. ipython:: python | ||
|
||
left_df = pd.DataFrame({'animal': ['dog', 'pig'], 'max_speed': [40, 11]}) | ||
right_df = pd.DataFrame({'animal': ['quetzal', 'pig'], 'max_speed': [80, 11]}) | ||
left_df | ||
right_df | ||
|
||
*pandas 1.0.x* | ||
|
||
.. code-block:: python | ||
|
||
>>> left_df.merge(right_df, on=['animal', 'max_speed'], how="right") | ||
animal max_speed | ||
0 pig 11 | ||
1 quetzal 80 | ||
|
||
*pandas 1.1.0* | ||
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. current behavior |
||
|
||
.. ipython:: python | ||
|
||
left_df.merge(right_df, on=['animal', 'max_speed'], how="right") | ||
|
||
.. --------------------------------------------------------------------------- | ||
|
||
.. _whatsnew_110.api_breaking.assignment_to_multiple_columns: | ||
|
This file contains 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
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to prior behavior