Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
BUG: fix df.where(cond) when cond is empty #21947
@@ Coverage Diff @@ ## master #21947 +/- ## ========================================== + Coverage 92.25% 92.25% +<.01% ========================================== Files 161 161 Lines 51169 51170 +1 ========================================== + Hits 47207 47208 +1 Misses 3962 3962
I wanted to write a test, but I did not find where were the unit tests for the 'where' function.
This is indeed a corner case, when both df and cond are empty. Example:
This kind of corner case do happen :
I had the same kind of corner case with df.duplicated in previous version of pandas.
But it is a bug to raise an error when they are both empty, no ?
As the bug is on
One could also explicitly check for
Jul 25, 2018
I believe the bug in the CI was not caused by changes in this PR.
This PR fixed a simple but real bug. I managed to fix it in another way for my client, so I only did this PR if it can improve pandas, especially in those edges cases that can be really annoying.
I added a test, a whatsnew entry and answered your comments.
Otherwise keep it close, it's too much an investment for such a minor improvment.