From 361102eac658473ebb0d38bc9fa6fe864fb1771e Mon Sep 17 00:00:00 2001 From: Ajith Aravind Date: Fri, 10 May 2024 00:08:27 +0530 Subject: [PATCH] fix: pandas 2 plus check & remove pyarrow string equivalent Signed-off-by: Ajith Aravind --- pandera/engines/pandas_engine.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandera/engines/pandas_engine.py b/pandera/engines/pandas_engine.py index 1218da795..365a93173 100644 --- a/pandera/engines/pandas_engine.py +++ b/pandera/engines/pandas_engine.py @@ -75,6 +75,7 @@ PANDAS_1_2_0_PLUS = pandas_version().release >= (1, 2, 0) PANDAS_1_3_0_PLUS = pandas_version().release >= (1, 3, 0) +PANDAS_2_0_0_PLUS = pandas_version().release >= (2, 0, 0) # register different TypedDict type depending on python version @@ -1588,7 +1589,7 @@ def __str__(self) -> str: # pyarrow types ############################################################################### -if PYARROW_INSTALLED: +if PYARROW_INSTALLED and PANDAS_2_0_0_PLUS: @Engine.register_dtype(equivalents=["bool[pyarrow]", pyarrow.bool_]) @immutable @@ -1629,7 +1630,7 @@ class ArrowInt8(ArrowInt16): type = pd.ArrowDtype(pyarrow.int8()) bit_width: int = 8 - @Engine.register_dtype(equivalents=["string[pyarrow]", pyarrow.string]) + @Engine.register_dtype(equivalents=[pyarrow.string]) @immutable class ArrowString(DataType, dtypes.String): """Semantic representation of a :class:`pyarrow.string`."""