Skip to content
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

[ArrowStringArray] CLN: remove hasattr checks #41327

Merged
merged 5 commits into from
May 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update isin to use pa_version_under
simonjayhawkins committed May 5, 2021
commit df7b613397006d63097e8382362cb1f39e5cbcf9
7 changes: 3 additions & 4 deletions pandas/core/arrays/string_arrow.py
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
)
from pandas.compat import (
pa_version_under2p0,
pa_version_under3p0,
pa_version_under4p0,
)
from pandas.util._decorators import doc
@@ -671,9 +672,7 @@ def take(
return type(self)(self._data.take(indices_array))

def isin(self, values):

# pyarrow.compute.is_in added in pyarrow 2.0.0
if not hasattr(pc, "is_in"):
if pa_version_under2p0:
return super().isin(values)

value_set = [
@@ -688,7 +687,7 @@ def isin(self, values):
return np.zeros(len(self), dtype=bool)

kwargs = {}
if LooseVersion(pa.__version__) < "3.0.0":
if pa_version_under3p0:
# in pyarrow 2.0.0 skip_null is ignored but is a required keyword and raises
# with unexpected keyword argument in pyarrow 3.0.0+
kwargs["skip_null"] = True