-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix combine_first converts other columns type into floats unexpectedly #20965
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #20965 +/- ##
==========================================
- Coverage 92.19% 92.19% -0.01%
==========================================
Files 169 169
Lines 50873 50879 +6
==========================================
+ Hits 46904 46908 +4
- Misses 3969 3971 +2
Continue to review full report at Codecov.
|
Thanks @jreback, fixed! |
can you add a whatsnew note. also rebase on master; I cleaned some older code out of here (shouldn't impact but just to be sure) |
@Licht-T Do you have time to update this? |
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.
can you update and add a whatnew (0.23.2) is ok
can you rebase / update? @gfyoung if not, can you fix the note |
b4753f1
to
361113a
Compare
Hello @Licht-T! Thanks for updating the PR.
|
361113a
to
37053e2
Compare
@jreback : Comments addressed, and all is rebased and green. PTAL. |
pandas/core/frame.py
Outdated
# try to promote series, which is all NaN, as other_dtype. | ||
new_dtype = other_dtype | ||
try: | ||
series = series.astype(new_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.
add copy=False
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.
Done.
@@ -750,6 +750,16 @@ def test_combine_first_int(self): | |||
tm.assert_frame_equal(res, df1) | |||
assert res['a'].dtype == 'int64' | |||
|
|||
def test_combine_first_with_asymmetric_other(self): |
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.
can you try the same when IsInt is actually a float as well (maybe call it something else)
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.
as an additional test case (you can parametrize)
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.
Done.
37053e2
to
df89c71
Compare
@jreback : Comments addressed, and all is rebased and green. PTAL. |
git diff upstream/master -u -- "*.py" | flake8 --diff