rok commented on PR #47977:
URL: https://github.com/apache/arrow/pull/47977#issuecomment-3456604192

   I see there exists a `skipkeys` parameter for `json.dumps`:
   
   > If skipkeys is false (the default), a 
[TypeError](https://docs.python.org/3/library/exceptions.html#TypeError) will 
be raised when trying to encode keys that are not 
[str](https://docs.python.org/3/library/stdtypes.html#str), 
[int](https://docs.python.org/3/library/functions.html#int), 
[float](https://docs.python.org/3/library/functions.html#float), 
[bool](https://docs.python.org/3/library/functions.html#bool) or None. If 
skipkeys is true, such items are simply skipped.
   
   If we didn't care about the warning we could do:
   
   ```python
       return {
           b'pandas': json.dumps({
               'index_columns': index_descriptors,
               'column_indexes': column_indexes,
               'columns': column_metadata + index_column_metadata,
               'attributes': json.dumps(attributes, skipkeys=True),
               'creator': {
                   'library': 'pyarrow',
                   'version': pa.__version__
               },
               'pandas_version': _pandas_api.version
           }).encode('utf8')
       }


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