File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ from cython cimport (
4141from pandas._config import using_string_dtype
4242
4343from pandas._libs.missing import check_na_tuples_nonequal
44+ from pandas.compat import PYARROW_INSTALLED
4445from pandas.util._decorators import set_module
4546
4647import_datetime()
@@ -122,13 +123,12 @@ i8max = <int64_t>INT64_MAX
122123u8max = < uint64_t> UINT64_MAX
123124
124125
125- cdef bint PYARROW_INSTALLED = False
126+ cdef bint c_PYARROW_INSTALLED = PYARROW_INSTALLED
126127
127- try :
128- import pyarrow as pa
129128
130- PYARROW_INSTALLED = True
131- except ImportError :
129+ if c_PYARROW_INSTALLED:
130+ import pyarrow as pa
131+ else :
132132 pa = None
133133
134134
@@ -1326,7 +1326,7 @@ def is_pyarrow_array(obj):
13261326 -------
13271327 bool
13281328 """
1329- if PYARROW_INSTALLED :
1329+ if c_PYARROW_INSTALLED :
13301330 return isinstance (obj, (pa.Array, pa.ChunkedArray))
13311331 return False
13321332
Original file line number Diff line number Diff line change 2727from pandas .compat .numpy import is_numpy_dev
2828from pandas .compat .pyarrow import (
2929 HAS_PYARROW ,
30+ PYARROW_INSTALLED ,
3031 PYARROW_MIN_VERSION ,
3132 pa_version_under14p0 ,
3233 pa_version_under14p1 ,
@@ -160,6 +161,7 @@ def is_ci_environment() -> bool:
160161 "ISMUSL" ,
161162 "PY312" ,
162163 "PY314" ,
164+ "PYARROW_INSTALLED" ,
163165 "PYARROW_MIN_VERSION" ,
164166 "PYPY" ,
165167 "WASM" ,
Original file line number Diff line number Diff line change 2323 pa_version_under21p0 = _palv < Version ("21.0.0" )
2424 pa_version_under22p0 = _palv < Version ("22.0.0" )
2525 pa_version_under23p0 = _palv < Version ("23.0.0" )
26+ PYARROW_INSTALLED = True
2627 HAS_PYARROW = _palv >= Version (PYARROW_MIN_VERSION )
2728except ImportError :
2829 pa_version_under14p0 = True
3637 pa_version_under21p0 = True
3738 pa_version_under22p0 = True
3839 pa_version_under23p0 = True
40+ PYARROW_INSTALLED = False
3941 HAS_PYARROW = False
4042
4143
You can’t perform that action at this time.
0 commit comments