This is an automated email from the ASF dual-hosted git repository.

apitrou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 48fee66  ARROW-10849: [Python] Handle numpy deprecation warnings for 
builtin type aliases
48fee66 is described below

commit 48fee6672bd8f740cfde9efdec0004641bf462c2
Author: Joris Van den Bossche <[email protected]>
AuthorDate: Mon Dec 14 15:30:43 2020 +0100

    ARROW-10849: [Python] Handle numpy deprecation warnings for builtin type 
aliases
    
    Mostly in tests, one in actual code
    
    Closes #8869 from jorisvandenbossche/ARROW-10846
    
    Authored-by: Joris Van den Bossche <[email protected]>
    Signed-off-by: Antoine Pitrou <[email protected]>
---
 python/pyarrow/pandas_compat.py              | 2 +-
 python/pyarrow/tests/test_convert_builtin.py | 2 +-
 python/pyarrow/tests/test_pandas.py          | 8 ++++----
 python/pyarrow/tests/test_schema.py          | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/python/pyarrow/pandas_compat.py b/python/pyarrow/pandas_compat.py
index 97adb41..935f495 100644
--- a/python/pyarrow/pandas_compat.py
+++ b/python/pyarrow/pandas_compat.py
@@ -1028,7 +1028,7 @@ _pandas_logical_type_map = {
     'bytes': np.bytes_,
     'string': np.str_,
     'integer': np.int64,
-    'floating': np.float,
+    'floating': np.float64,
     'empty': np.object_,
 }
 
diff --git a/python/pyarrow/tests/test_convert_builtin.py 
b/python/pyarrow/tests/test_convert_builtin.py
index d35d44a..665c14f 100644
--- a/python/pyarrow/tests/test_convert_builtin.py
+++ b/python/pyarrow/tests/test_convert_builtin.py
@@ -174,7 +174,7 @@ def test_sequence_boolean(seq):
 
 @parametrize_with_iterable_types
 def test_sequence_numpy_boolean(seq):
-    expected = [np.bool(True), None, np.bool(False), None]
+    expected = [np.bool_(True), None, np.bool_(False), None]
     arr = pa.array(seq(expected))
     assert arr.type == pa.bool_()
     assert arr.to_pylist() == [True, None, False, None]
diff --git a/python/pyarrow/tests/test_pandas.py 
b/python/pyarrow/tests/test_pandas.py
index 6c0ff66..0671121 100644
--- a/python/pyarrow/tests/test_pandas.py
+++ b/python/pyarrow/tests/test_pandas.py
@@ -2523,10 +2523,10 @@ class TestConvertMisc:
         (np.float64, pa.float64()),
         # XXX unsupported
         # (np.dtype([('a', 'i2')]), pa.struct([pa.field('a', pa.int16())])),
-        (np.object, pa.string()),
-        (np.object, pa.binary()),
-        (np.object, pa.binary(10)),
-        (np.object, pa.list_(pa.int64())),
+        (np.object_, pa.string()),
+        (np.object_, pa.binary()),
+        (np.object_, pa.binary(10)),
+        (np.object_, pa.list_(pa.int64())),
     ]
 
     def test_all_none_objects(self):
diff --git a/python/pyarrow/tests/test_schema.py 
b/python/pyarrow/tests/test_schema.py
index da67aaa..2dc732f 100644
--- a/python/pyarrow/tests/test_schema.py
+++ b/python/pyarrow/tests/test_schema.py
@@ -208,7 +208,7 @@ def test_from_numpy_dtype():
 
     # Things convertible to numpy dtypes work
     assert pa.from_numpy_dtype('U') == pa.string()
-    assert pa.from_numpy_dtype(np.unicode) == pa.string()
+    assert pa.from_numpy_dtype(np.str_) == pa.string()
     assert pa.from_numpy_dtype('int32') == pa.int32()
     assert pa.from_numpy_dtype(bool) == pa.bool_()
 

Reply via email to