You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "AlenkaF (via GitHub)" <gi...@apache.org> on 2023/03/06 09:08:49 UTC

[GitHub] [arrow] AlenkaF commented on a diff in pull request #34445: GH-34283 [Python] Add types_mapper support to index for to_pandas

AlenkaF commented on code in PR #34445:
URL: https://github.com/apache/arrow/pull/34445#discussion_r1126116923


##########
python/pyarrow/tests/test_pandas.py:
##########
@@ -647,6 +647,23 @@ def test_mismatch_metadata_schema(self):
             result = new_table.to_pandas()
             tm.assert_frame_equal(result, expected)
 
+    @pytest.mark.parametrize("index", ["a", ["a", "b"]])
+    def test_to_pandas_types_mapper_index(self, index):
+        if Version(pd.__version__) < Version("1.5.0"):
+            pytest.skip("ArrowDtype missing")
+        df = pd.DataFrame(
+            {
+                "a": [1, 2],
+                "b": [3, 4],
+                "c": [5, 6],
+            },
+            dtype=pd.ArrowDtype(pa.int64()),
+        ).set_index(index)
+        expected = df.copy()

Review Comment:
   Why is the copy needed?



-- 
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-unsubscribe@arrow.apache.org

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