-
-
Notifications
You must be signed in to change notification settings - Fork 19.1k
BUG: clip raising with na series bounds for datetimes or ea int #45161
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7381,7 +7381,13 @@ def _clip_with_one_bound(self, threshold, method, axis, inplace): | |
# GH 40420 | ||
# 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 | ||
method_name_le = method.__name__ == "le" | ||
if is_datetime64_any_dtype(self.dtype): | ||
fill_value = Timestamp.max if method_name_le else Timestamp.min | ||
|
||
elif is_extension_array_dtype(self.dtype): | ||
fill_value = self.max() if method_name_le else self.min() | ||
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. Is there a better way to do this for ea ints? 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.
|
||
else: | ||
fill_value = np.inf if method_name_le else -np.inf | ||
threshold_inf = threshold.fillna(fill_value) | ||
else: | ||
threshold_inf = threshold | ||
|
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 move to 1.5