summaryrefslogtreecommitdiffstats
path: root/contrib/python/pyarrow/patches/02-pr38040-support-numpy-2.patch
blob: 7d0fc87fbb2f125e044072d29eb6fb03bb2d4ba9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
--- contrib/python/pyarrow/pyarrow/pandas_compat.py	(index)
+++ contrib/python/pyarrow/pyarrow/pandas_compat.py	(working tree)
@@ -30,6 +30,7 @@ import re
 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, builtin_pickle, frombytes  # noqa
@@ -97,7 +98,7 @@ _numpy_logical_type_map = {
     np.float32: 'float32',
     np.float64: 'float64',
     'datetime64[D]': 'date',
-    np.unicode_: 'string',
+    np.str_: 'string',
     np.bytes_: 'bytes',
 }
 
@@ -796,7 +797,7 @@ def table_to_blockmanager(options, table, categories=None,
 # 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'] +
+    for typ in (_np_sctypes['int'] + _np_sctypes['uint'] + _np_sctypes['float'] +
                 ['object', 'bool'])
 }
 
@@ -1021,7 +1022,7 @@ def _is_generated_index_name(name):
 _pandas_logical_type_map = {
     'date': 'datetime64[D]',
     'datetime': 'datetime64[ns]',
-    'unicode': np.unicode_,
+    'unicode': np.str_,
     'bytes': np.bytes_,
     'string': np.str_,
     'integer': np.int64,