Skip to content
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

GH-45296: [Python] Only enable the string dtype on pandas export for pandas>=2.3 #45383

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions python/pyarrow/pandas-shim.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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')

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading