AlenkaF commented on a change in pull request #12178:
URL: https://github.com/apache/arrow/pull/12178#discussion_r787630984



##########
File path: python/pyarrow/tests/test_table.py
##########
@@ -339,6 +339,42 @@ def test_chunked_array_to_pandas_preserve_name():
         tm.assert_series_equal(result, expected)
 
 
+@pytest.mark.pandas
+def test_array_to_pandas_types_mapper():
+    # https://issues.apache.org/jira/browse/ARROW-9664
+    import pandas as pd
+    import numpy as np
+
+    # Extension types got introduced in later versions of Pandas
+    if "0.23" < pd.__version__ < "1.0.0":
+        types_mapper = {pa.int64(): np.int64}.get
+    else:
+        types_mapper = {pa.int64(): pd.Int64Dtype()}.get
+    data = pa.array([1, 2, 3], pa.int64())
+    result = data.to_pandas(types_mapper=types_mapper)
+
+    assert result.dtype == types_mapper(data.type)
+
+
+@pytest.mark.pandas
+def test_chunked_array_to_pandas_types_mapper():
+    # https://issues.apache.org/jira/browse/ARROW-9664
+    import pandas as pd
+
+    # Extension types got introduced in later versions of Pandas
+    if "0.23" < pd.__version__ < "1.0.0":
+        types_mapper = {pa.int64(): np.int64}.get
+    else:
+        types_mapper = {pa.int64(): pd.Int64Dtype()}.get

Review comment:
       I am not sure if this is the way to fix CI erroring for Pandas version 
0.23. Happy to receive comments about it.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to