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


##########
python/pyarrow/pandas_compat.py:
##########
@@ -378,7 +378,10 @@ def _index_level_name(index, i, column_names):
     if index.name is not None and index.name not in column_names:
         return _column_name_to_strings(index.name)
     else:
-        return f'__index_level_{i:d}__'
+        j = i
+        while f'__index_level_{j:d}__' in column_names:
+            j += 1
+        return f'__index_level_{j:d}__'

Review Comment:
   OK, getting used to this :) Copilot can't answer. Well, I think the change 
suggested can be a possible follow-up if we see this would be needed. But I do 
not think it is in the scope of this PR.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to