Skip to content

CLN: _maybe_upcast_for_op doesn't need to check timedelta ndarray #40399

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

Merged

Conversation

jorisvandenbossche
Copy link
Member

The elif isinstance(obj, np.ndarray) and obj.dtype.kind == "m": part is ever reached, because just before calling _maybe_upcast_for_op, we already did a ensure_wrapped_if_datetimelike which basically does the same (codedov also confirms it's not covered). So therefore removing that check.

In addition, moving the Datetime/TimedeltaArray inline within the if/elif checks, this gives a little bit less overhead for the non-datetimelike cases.

@jorisvandenbossche jorisvandenbossche added Clean Numeric Operations Arithmetic, Comparison, and Logical operations labels Mar 12, 2021
Copy link
Member

@jbrockmendel jbrockmendel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jorisvandenbossche jorisvandenbossche merged commit cb130fd into pandas-dev:master Mar 17, 2021
@jorisvandenbossche jorisvandenbossche deleted the ops-cln-maybe_upcast branch March 17, 2021 07:22
@jorisvandenbossche jorisvandenbossche added this to the 1.3 milestone Mar 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Numeric Operations Arithmetic, Comparison, and Logical operations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants