-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Fix 40420: Interpret NaN in clip() as no bound. #40927
Conversation
DriesSchaumont
commented
Apr 13, 2021
•
edited
Loading
edited
- closes BUG: clip where the bound is a series with NA values returns NA #40420
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
Yes, I believe according to @jreback and this issue we want to treat any "nullish" value as no bound: #17276 |
b7b1311
to
7a89037
Compare
7a89037
to
751c8a9
Compare
I think non-green is not related here. |
thanks @DriesSchaumont |
# Treat missing thresholds as no bounds, not clipping the values | ||
if is_list_like(threshold): | ||
fill_value = np.inf if method.__name__ == "le" else -np.inf | ||
threshold_inf = threshold.fillna(fill_value) |
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.
This causes an issue when working with datetime series (see here: #44785). Since downstream it will try to compare a float to a Timestamp object. There's probably a more robust solution, but a potential quick/easy fix would be to check the dtype here and use an appropriate alternative to np.inf (e.g. pd.Timestamp.max/min).