-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix pd.read_orc raising AttributeError #40970
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
Changes from 1 commit
67a6e5b
0623037
e61629a
728d26d
ef76984
8728848
d0c34db
2d665cd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
import pandas._testing as tm | ||
|
||
pytest.importorskip("pyarrow", minversion="0.13.0") | ||
pytest.importorskip("pyarrow.orc") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the tests might fail without this, since orc doesn't import properly for certain OSes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it will raise some errors on Windows env. But if add this line to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe try There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, let me re-describe the reason for deleting this line. If the PyArrow package is installed from Conda, But, AttributeError will be raised if the user uses Maybe we should keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I am hypothesizing that the bug will reproduce since |
||
|
||
pytestmark = pytest.mark.filterwarnings( | ||
"ignore:RangeIndex.* is deprecated:DeprecationWarning" | ||
|
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.
pyarrrow should only be imported once, so should remove the
import pyarrow
statement a couple lines up.Uh oh!
There was an error while loading. Please reload this page.
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.
Line-49 will check the PyArrow's version, it depends on line-47(
import PyArrow
).Uh oh!
There was an error while loading. Please reload this page.
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.
Looking again, it's better to use
pandas/pandas/compat/_optional.py
Line 63 in 04f9a4b
so would be something like
and then we could get rid of the other code.
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 already tested it and it looks good. But it will remind users to install
pyarrow.orc
instead ofpyarrow
since import_optional_dependency cannot receive customized error messages. Is that OK?Log:
ImportError: Missing optional dependency 'pyarrow.orc'. Use pip or conda to install pyarrow.orc.