From 4e403be5e2358c89a5bec74c64aa791f52931cc1 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 9 Jan 2024 14:40:16 +0100 Subject: [PATCH 1/2] GH-39533: [Python] NumPy 2.0 compat: remove usage of np.core --- python/pyarrow/pandas_compat.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/pyarrow/pandas_compat.py b/python/pyarrow/pandas_compat.py index 3757d81a478..7953707acc3 100644 --- a/python/pyarrow/pandas_compat.py +++ b/python/pyarrow/pandas_compat.py @@ -30,7 +30,6 @@ import warnings import numpy as np -from numpy.core.numerictypes import sctypes as _np_sctypes import pyarrow as pa from pyarrow.lib import _pandas_api, frombytes # noqa @@ -789,9 +788,10 @@ def table_to_dataframe( # Set of the string repr of all numpy dtypes that can be stored in a pandas # dataframe (complex not included since not supported by Arrow) _pandas_supported_numpy_types = { - str(np.dtype(typ)) - for typ in (_np_sctypes['int'] + _np_sctypes['uint'] + _np_sctypes['float'] + - ['object', 'bool']) + "int8", "int16", "int32", "int64", + "uint8", "uint16", "uint32", "uint64", + "float16", "float32", "float64", "float128", + "object", "bool" } From 7f5dcd8925c695d90c9cd5086462d7fab075fee7 Mon Sep 17 00:00:00 2001 From: Joris Van den Bossche Date: Tue, 9 Jan 2024 16:21:37 +0100 Subject: [PATCH 2/2] remove float128 --- python/pyarrow/pandas_compat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyarrow/pandas_compat.py b/python/pyarrow/pandas_compat.py index 7953707acc3..39dee854924 100644 --- a/python/pyarrow/pandas_compat.py +++ b/python/pyarrow/pandas_compat.py @@ -790,7 +790,7 @@ def table_to_dataframe( _pandas_supported_numpy_types = { "int8", "int16", "int32", "int64", "uint8", "uint16", "uint32", "uint64", - "float16", "float32", "float64", "float128", + "float16", "float32", "float64", "object", "bool" }