ENH: Improve error message when specifying dtype="float32[pyarrow]" while PyArrow is not installed #57928
Closed
1 of 3 tasks
Labels
Arrow
pyarrow functionality
Dependencies
Required and optional dependencies
Enhancement
Error Reporting
Incorrect or improved errors from pandas
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
If PyArrow is not installed properly, running the following code snippet from the User Guide:
ser = pd.Series([-1.5, 0.2, None], dtype="float32[pyarrow]")
will result in:
which is not very informative.
Feature Description
We can improve the error message by letting the user know that there is something wrong regarding the installation of PyArrow, especially when the user believes that he/she has installed PyArrow, but actually installed it in a wrong location or installed an outdated version.
Alternative Solutions
Catch the
NameError
and raise anotherImportError
from it describing what happened.Additional Context
This conforms to the description in Installation Guide: If the optional dependency is not installed, pandas will raise an
ImportError
when the method requiring that dependency is called.The text was updated successfully, but these errors were encountered: