Skip to content

Commit 15f9833

Browse files
committed
BUG: GH38801 avoid attribute error with pyarrow >=0.16.0 and <1.0.0
update pyarrow Update ci/deps/actions-37-locale.yaml Co-authored-by: Joris Van den Bossche <[email protected]> fixup
1 parent f58d815 commit 15f9833

File tree

3 files changed

+16
-10
lines changed

3 files changed

+16
-10
lines changed

ci/deps/actions-37-locale.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies:
3030
- openpyxl
3131
- pandas-gbq
3232
- google-cloud-bigquery>=1.27.2 # GH 36436
33-
- pyarrow>=0.17
33+
- pyarrow=0.17 # GH 38803
3434
- pytables>=3.5.1
3535
- scipy
3636
- xarray=0.12.3

pandas/core/arrays/string_arrow.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,20 @@
3636
except ImportError:
3737
pass
3838
else:
39-
ARROW_CMP_FUNCS = {
40-
"eq": pc.equal,
41-
"ne": pc.not_equal,
42-
"lt": pc.less,
43-
"gt": pc.greater,
44-
"le": pc.less_equal,
45-
"ge": pc.greater_equal,
46-
}
39+
# pyarrow 0.16.0 adds a compute module (thus the above compute import
40+
# will work) but the attributes below are not available until pyarrow
41+
# 1.0.0 resulting in an Attribute Error with pyarrow (0.16.0, 1.0.0].
42+
try:
43+
ARROW_CMP_FUNCS = {
44+
"eq": pc.equal,
45+
"ne": pc.not_equal,
46+
"lt": pc.less,
47+
"gt": pc.greater,
48+
"le": pc.less_equal,
49+
"ge": pc.greater_equal,
50+
}
51+
except AttributeError:
52+
pass
4753

4854

4955
if TYPE_CHECKING:

pandas/tests/io/test_parquet.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -896,7 +896,7 @@ def test_timezone_aware_index(self, pa, timezone_aware_date_list):
896896
# this use-case sets the resolution to 1 minute
897897
check_round_trip(df, pa, check_dtype=False)
898898

899-
@td.skip_if_no("pyarrow", min_version="0.17")
899+
@td.skip_if_no("pyarrow", min_version="1.0.0")
900900
def test_filter_row_groups(self, pa):
901901
# https://github.com/pandas-dev/pandas/issues/26551
902902
df = pd.DataFrame({"a": list(range(0, 3))})

0 commit comments

Comments
 (0)