-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Duck array ops for all
and any
#9883
base: main
Are you sure you want to change the base?
Conversation
With a simple search I see that there's a bunch of |
for more information, see https://pre-commit.ci
f67c87d
to
d8367b2
Compare
I updated this to replace more |
for more information, see https://pre-commit.ci
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.
Thanks @tomwhite
@@ -204,9 +204,9 @@ def format_items(x): | |||
day_part = x[~pd.isnull(x)].astype("timedelta64[D]").astype("timedelta64[ns]") | |||
time_needed = x[~pd.isnull(x)] != day_part | |||
day_needed = day_part != np.timedelta64(0, "ns") | |||
if np.logical_not(day_needed).all(): | |||
if array_all(np.logical_not(day_needed)): |
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.
surprised we haven't updated the logical_not
yet
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.
Could just use
if array_all(np.logical_not(day_needed)): | |
if array_all(~day_needed): |
Or not?
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.
I think ~
is np.invert
/xp.bitwise_invert
, so possibly different? I'll leave this for a future PR if that's OK.
@@ -204,9 +204,9 @@ def format_items(x): | |||
day_part = x[~pd.isnull(x)].astype("timedelta64[D]").astype("timedelta64[ns]") | |||
time_needed = x[~pd.isnull(x)] != day_part | |||
day_needed = day_part != np.timedelta64(0, "ns") | |||
if np.logical_not(day_needed).all(): | |||
if array_all(np.logical_not(day_needed)): |
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.
Could just use
if array_all(np.logical_not(day_needed)): | |
if array_all(~day_needed): |
Or not?
Another change to use
duck_array_ops
for some instances ofall
andany
.whats-new.rst
api.rst