-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TYP: datetimelike #38307
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
TYP: datetimelike #38307
Conversation
@@ -755,28 +760,30 @@ def isin(self, values) -> np.ndarray: | |||
# ------------------------------------------------------------------ | |||
# Null Handling | |||
|
|||
def isna(self): | |||
def isna(self) -> np.ndarray: |
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.
we dont' have the typing ability to do np.ndarray[bool]
yet right?
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.
not yet, correct
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.
looks like will be in numpy 1.21 numpy/numpy#17719
@@ -996,7 +1006,7 @@ def _add_timedeltalike_scalar(self, other): | |||
if isna(other): | |||
# i.e np.timedelta64("NaT"), not recognized by delta_to_nanoseconds | |||
new_values = np.empty(self.shape, dtype="i8") | |||
new_values[:] = iNaT | |||
new_values.fill(iNaT) |
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 use np.full here
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.
followon ok too (as many places where this is done), though prob easy to do here
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.
yah, we use .fill way more often, to the point that i sometimes forget that np.full is a thing
might actually be some perf boosts here due to using putmask |
yep thats the idea |
thanks |
use np.putmask in a few places, as it is appreciably more performant than
__setitem__