-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
REGR: fix inplace operations for EAs with non-EA arg #37986
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
Merged
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
668b0e1
BUG: update dtype check in _inplace_method
arw2019 f0938f6
TST: add tests for inplace ops
arw2019 2eda0c6
BUG: update dtype check in _inplace_method
arw2019 4107a96
TST: add tests for inplace ops
arw2019 bba3c5d
DOC: whatsnew
arw2019 0af5e59
feedback: reparametrize tests
arw2019 474cd73
GH ref
arw2019 383b936
feedback: move test to test_arithmetic
arw2019 3be0769
remove tests from old location
arw2019 0c4ee06
Merge branch 'master' of https://github.com/pandas-dev/pandas into GH…
arw2019 6b897ff
Merge branch 'GH37910' of https://github.com/arw2019/pandas into GH37910
arw2019 8b18f50
review comment: use tuples in test parametrization
arw2019 40170b6
review comment: whatsnew
arw2019 a6ad94c
Merge branch 'master' of https://github.com/pandas-dev/pandas into GH…
arw2019 cfb1874
merge conflict
arw2019 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
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
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import pytest | ||
|
||
from pandas import Series | ||
import pandas._testing as tm | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"dtype1, dtype2, dtype_expected, dtype_mul", | ||
( | ||
["Int64"] * 4, | ||
["float"] * 4, | ||
["Int64"] + ["float"] * 3, | ||
pytest.param( | ||
"Int64", | ||
"Float64", | ||
"Float64", | ||
"Float64", | ||
marks=pytest.mark.xfail(reason="Not implemented yet"), | ||
), | ||
), | ||
) | ||
def test_series_inplace_ops(dtype1, dtype2, dtype_expected, dtype_mul): | ||
jbrockmendel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
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. GH ref to either this PR or original issue 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. Done |
||
ser1 = Series([1], dtype=dtype1) | ||
ser2 = Series([2], dtype=dtype2) | ||
ser1 += ser2 | ||
expected = Series([3], dtype=dtype_expected) | ||
tm.assert_series_equal(ser1, expected) | ||
|
||
ser1 -= ser2 | ||
expected = Series([1], dtype=dtype_expected) | ||
tm.assert_series_equal(ser1, expected) | ||
|
||
ser1 *= ser2 | ||
expected = Series([2], dtype=dtype_mul) | ||
tm.assert_series_equal(ser1, expected) |
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.
is it on EA or on Series with EA dtype?
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.
it's Series with EA dtype
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.
yeah let's reword this, its an inplace operation on a Series with an EA dtype with a numpyt dtyped operand
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.
Rewritten