You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/06/22 11:58:23 UTC

[GitHub] [arrow] lidavidm commented on a diff in pull request #13402: MINOR: [Python] Fix pandas conversion failure when using non-str index name

lidavidm commented on code in PR #13402:
URL: https://github.com/apache/arrow/pull/13402#discussion_r903652474


##########
python/pyarrow/tests/test_pandas.py:
##########
@@ -149,6 +149,12 @@ def test_non_string_columns(self):
         table = pa.Table.from_pandas(df)
         assert table.field(0).name == '0'
 
+    def test_non_string_columns_with_index(self):
+        df = pd.DataFrame({0: [1, 2, 3], 1: [4, 5, 6]})
+        df = df.set_index(0)
+        table = pa.Table.from_pandas(df)
+        assert table.field(0).name == '1'

Review Comment:
   I suppose, assuming round-tripping the type of the index names works, we should also `_check_pandas_roundtrip(df, preserve_index=True)` here



-- 
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