From cd762b4eb1fd55a0bc5079ed69bfc04426f10e60 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Fri, 26 Jul 2024 08:08:01 -1000 Subject: [PATCH] Gate ArrowStringArrayNumpySemantics cudf.pandas proxy behind version check (#16401) ## Description `ArrowStringArrayNumpySemantics` was newly added in 2.1: https://github.com/pandas-dev/pandas/blob/2.1.x/pandas/core/arrays/string_arrow.py#L488, so putting the proxy wrapper behind a version check for pandas 2.0.x compat ```ipython In [1]: %load_ext cudf.pandas In [2]: import pandas as pd In [3]: pd.__version__ Out[3]: '2.0.0' ``` ## Checklist - [ ] I am familiar with the [Contributing Guidelines](https://github.com/rapidsai/cudf/blob/HEAD/CONTRIBUTING.md). - [ ] New or existing tests cover these changes. - [ ] The documentation is up to date with these changes. --- python/cudf/cudf/pandas/_wrappers/pandas.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/python/cudf/cudf/pandas/_wrappers/pandas.py b/python/cudf/cudf/pandas/_wrappers/pandas.py index 59a243dd7c4..478108f36f1 100644 --- a/python/cudf/cudf/pandas/_wrappers/pandas.py +++ b/python/cudf/cudf/pandas/_wrappers/pandas.py @@ -26,6 +26,7 @@ ) import cudf +import cudf.core._compat from ..annotation import nvtx from ..fast_slow_proxy import ( @@ -556,13 +557,14 @@ def Index__setattr__(self, name, value): }, ) -ArrowStringArrayNumpySemantics = make_final_proxy_type( - "ArrowStringArrayNumpySemantics", - _Unusable, - pd.core.arrays.string_arrow.ArrowStringArrayNumpySemantics, - fast_to_slow=_Unusable(), - slow_to_fast=_Unusable(), -) +if cudf.core._compat.PANDAS_GE_210: + ArrowStringArrayNumpySemantics = make_final_proxy_type( + "ArrowStringArrayNumpySemantics", + _Unusable, + pd.core.arrays.string_arrow.ArrowStringArrayNumpySemantics, + fast_to_slow=_Unusable(), + slow_to_fast=_Unusable(), + ) ArrowStringArray = make_final_proxy_type( "ArrowStringArray",