-
-
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 GH16983 fix df.where with extension dtypes #24169
Conversation
Hello @JustinZhengBC! Thanks for submitting the PR.
|
Codecov Report
@@ Coverage Diff @@
## master #24169 +/- ##
===========================================
+ Coverage 43.02% 92.21% +49.18%
===========================================
Files 162 162
Lines 51700 51702 +2
===========================================
+ Hits 22245 47675 +25430
+ Misses 29455 4027 -25428
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #24169 +/- ##
===========================================
+ Coverage 43.02% 92.21% +49.18%
===========================================
Files 162 162
Lines 51700 51702 +2
===========================================
+ Hits 22245 47675 +25430
+ Misses 29455 4027 -25428
Continue to review full report at Codecov.
|
#24114 is fixing this. |
@@ -1341,6 +1341,8 @@ def func(cond, values, other): | |||
return values | |||
|
|||
values, other = self._try_coerce_args(values, other) | |||
if isinstance(values, ExtensionArray): | |||
values = values.get_values().reshape(-1, 1) # GH 16983 |
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.
Just FYI, we want to avoid get_values
since that converts the ExtensionArray to an ndarray.
git diff upstream/master -u -- "*.py" | flake8 --diff
The referenced issue showcases two bugs. I was not able to replicate the first one, but I tracked down the cause of the ndim ValueError in the second example. An ExtensionBlock passed to
df.where
used to be unpacked here into a 1D array while normal blocks are unpacked earlier here into a 2D nx1 array.