You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "qsourav (via GitHub)" <gi...@apache.org> on 2023/11/29 07:31:05 UTC

Re: [I] Bug in pyarrow.from_pandas() when input has MultiIndex index columns having non-string names [arrow]

qsourav commented on issue #38983:
URL: https://github.com/apache/arrow/issues/38983#issuecomment-1831357672

   The same seems to be fixed from the below workaround:
   https://github.com/apache/arrow/blob/1d904d64ba89835fa6587ed08121a06df51f92b4/python/pyarrow/pandas_compat.py#L511
   ```
   def _get_index_level_values(index):
       n = len(getattr(index, 'levels', [index]))
       if isinstance(index, _pandas_api.pd.MultiIndex):
           return [index.levels[i] for i in range(n)]
       else:
           return [index.get_level_values(i) for i in range(n)]
   ```


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