Skip to content

ArrowStringArray: delay/conditionally import pyarrow.compute #42863

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

Open
jorisvandenbossche opened this issue Aug 3, 2021 · 3 comments
Open
Labels
Bug Compat pandas objects compatability with Numpy or Python functions Strings String extension data type and string data

Comments

@jorisvandenbossche
Copy link
Member

We currently check if pyarrow is available (and a sufficiently recent version), and if that's the case, simply import pyarrow.compute:

if not pa_version_under1p0:
import pyarrow as pa
import pyarrow.compute as pc

However, in theory, it is possible to have a pyarrow installation without pyarrow.compute support (it's an optional component when building). In that case the import pyarrow.compute as pc import will fail giving a slightly confusing error message + it will fail on a basic import of pandas (even without using any pyarrow functionality).

@jorisvandenbossche jorisvandenbossche added Bug Strings String extension data type and string data Compat pandas objects compatability with Numpy or Python functions labels Aug 3, 2021
@jreback
Copy link
Contributor

jreback commented Aug 3, 2021

can u give a specific example where this happens? for all of the string functions we have min required checks AFAICT

@simonjayhawkins
Copy link
Member

The ArrowStringArray relies heavily on pyarrow.compute. better to raise than to delay/conditionally import?

@simonjayhawkins
Copy link
Member

we changed this in #41732

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Compat pandas objects compatability with Numpy or Python functions Strings String extension data type and string data
Projects
None yet
Development

No branches or pull requests

3 participants