Skip to content

ENH: support any/all for pyarrow numeric and duration dtypes #50717

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
merged 8 commits into from
Jan 24, 2023

Conversation

jbrockmendel
Copy link
Member

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Cuts the runtime for pytest pandas/tests/extension/test_arrow.py::TestBaseBooleanReduce::test_reduce_series from 39.8s to 2.3s.

zero = Timedelta(0)
else:
zero = 0
result = (self != zero)._reduce(name, skipna=skipna, **kwargs)
Copy link
Member

Choose a reason for hiding this comment

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

Could we use data = pc.not_equal(self._data, zero) and continue with the logic below?

@mroeschke mroeschke added the Arrow pyarrow functionality label Jan 19, 2023
else:
zero = 0

not_eq = pc.not_equal(self._data, zero)
Copy link
Member

Choose a reason for hiding this comment

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

Ah sorry, I had meant

if name in ...:
    ...
    data = pc.not_equal(self._data, zero)
else:
    data = self._data
....
try:
     result = pyarrow_method(data...)

@jbrockmendel
Copy link
Member Author

updated per requests + green

@mroeschke mroeschke added this to the 2.0 milestone Jan 24, 2023
@mroeschke mroeschke merged commit 2df4522 into pandas-dev:main Jan 24, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the enh-ea-reductions branch January 24, 2023 18:24
pooja-subramaniam pushed a commit to pooja-subramaniam/pandas that referenced this pull request Jan 25, 2023
…dev#50717)

* ENH: support any/all for pyarrow numeric and duration dtypes

* mypy fixup

* use pc.not_equal

* use suggested pattern

* fix not_eq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Arrow pyarrow functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants