You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by br...@apache.org on 2025/01/31 21:47:59 UTC
(arrow) 08/08: GH-45296: [Python] Only enable the string dtype on pandas export for pandas>=2.3 (#45383)
This is an automated email from the ASF dual-hosted git repository.
brycemecum pushed a commit to branch maint-19.0.1
in repository https://gitbox.apache.org/repos/asf/arrow.git
commit e696b2612fef0c3474fa2df6548df30464f7654f
Author: Joris Van den Bossche <jo...@gmail.com>
AuthorDate: Thu Jan 30 13:16:04 2025 +0100
GH-45296: [Python] Only enable the string dtype on pandas export for pandas>=2.3 (#45383)
The option already exists in pandas 2.2, but for that version our code does not work, so restricting it to pandas >= 2.3
* GitHub Issue: #45296
Authored-by: Joris Van den Bossche <jo...@gmail.com>
Signed-off-by: Raúl Cumplido <ra...@gmail.com>
---
python/pyarrow/pandas-shim.pxi | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/python/pyarrow/pandas-shim.pxi b/python/pyarrow/pandas-shim.pxi
index 5be6f03f86..aab9cf1079 100644
--- a/python/pyarrow/pandas-shim.pxi
+++ b/python/pyarrow/pandas-shim.pxi
@@ -38,7 +38,7 @@ cdef class _PandasAPIShim(object):
object _array_like_types, _is_extension_array_dtype, _lock
bint has_sparse
bint _pd024
- bint _is_v1, _is_ge_v21, _is_ge_v3, _is_ge_v3_strict
+ bint _is_v1, _is_ge_v21, _is_ge_v23, _is_ge_v3, _is_ge_v3_strict
def __init__(self):
self._lock = Lock()
@@ -79,6 +79,7 @@ cdef class _PandasAPIShim(object):
self._is_v1 = self._loose_version < Version('2.0.0')
self._is_ge_v21 = self._loose_version >= Version('2.1.0')
+ self._is_ge_v23 = self._loose_version >= Version('2.3.0')
self._is_ge_v3 = self._loose_version >= Version('3.0.0.dev0')
self._is_ge_v3_strict = self._loose_version >= Version('3.0.0')
@@ -171,6 +172,10 @@ cdef class _PandasAPIShim(object):
self._check_import()
return self._is_ge_v21
+ def is_ge_v23(self):
+ self._check_import()
+ return self._is_ge_v23
+
def is_ge_v3(self):
self._check_import()
return self._is_ge_v3
@@ -183,7 +188,7 @@ cdef class _PandasAPIShim(object):
if self.is_ge_v3_strict():
return True
try:
- if self.pd.options.future.infer_string:
+ if self.is_ge_v23() and self.pd.options.future.infer_string:
return True
except:
pass