Skip to content

Commit 95b8fd8

Browse files
ADragindameeseeksmachine
authored andcommitted
Backport PR pandas-dev#38803: BUG: avoid attribute error with pyarrow >=0.16.0 and <1.0.0
1 parent 200b1a3 commit 95b8fd8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
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

doc/source/whatsnew/v1.2.1.rst

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ I/O
3737

3838
- Bumped minimum fastparquet version to 0.4.0 to avoid ``AttributeError`` from numba (:issue:`38344`)
3939
- Bumped minimum pymysql version to 0.8.1 to avoid test failures (:issue:`38344`)
40+
- Fixed ``AttributeError`` with PyArrow versions [0.16.0, 1.0.0) (:issue:`38801`)
4041

4142
-
4243
-

pandas/core/arrays/string_arrow.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
except ImportError:
3030
pa = None
3131
else:
32-
# our min supported version of pyarrow, 0.15.1, does not have a compute
33-
# module
34-
try:
32+
# PyArrow backed StringArrays are available starting at 1.0.0, but this
33+
# file is imported from even if pyarrow is < 1.0.0, before pyarrow.compute
34+
# and its compute functions existed. GH38801
35+
if LooseVersion(pa.__version__) >= "1.0.0":
3536
import pyarrow.compute as pc
36-
except ImportError:
37-
pass
38-
else:
37+
3938
ARROW_CMP_FUNCS = {
4039
"eq": pc.equal,
4140
"ne": pc.not_equal,

pandas/tests/io/test_parquet.py

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

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

0 commit comments

Comments
 (0)