-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
PERF: Fix regression in datetime ops #17980
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 |
---|---|---|
|
@@ -622,6 +622,10 @@ def _is_offset(self, arr_or_obj): | |
""" check if obj or all elements of list-like is DateOffset """ | ||
if isinstance(arr_or_obj, ABCDateOffset): | ||
return True | ||
elif (is_datetime64_dtype(arr_or_obj) or | ||
is_timedelta64_dtype(arr_or_obj)): | ||
# Don't want to check elementwise for Series / array of datetime | ||
return False | ||
elif is_list_like(arr_or_obj) and len(arr_or_obj): | ||
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. you actually only do this check if 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. I think d0ea5dc has want you meant, much cleaner. |
||
return all(isinstance(x, ABCDateOffset) for x in arr_or_obj) | ||
return 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.
catch period here as well?
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.
What binary ops is a
PeriodIndex
valid in (if any)?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.
is_period
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.
sorry, we have
is_period_dtype
which is the correct to use here