xubinlaile commented on issue #8270:
URL: https://github.com/apache/arrow/issues/8270#issuecomment-699011960


   > Thanks for the report!
   > 
   > Can you provide a copy-pastable example so we can reproduce the issue 
locally and investigate? See 
[here](https://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports) for 
info on what's needed from our side.
   
   i copy parts of the example then run in my  machine.       code is here :   
arrow/python/examples/plasma/sorting/
   answers in 
   
https://stackoverflow.com/questions/50916422/python-typeerror-object-of-type-int64-is-not-json-serializable:
   
   import json
   import numpy as np
   
   class NpEncoder(json.JSONEncoder):
       def default(self, obj):
           if isinstance(obj, np.integer):
               return int(obj)
           elif isinstance(obj, np.floating):
               return float(obj)
           elif isinstance(obj, np.ndarray):
               return obj.tolist()
           else:
               return super(NpEncoder, self).default(obj)
   
   # Your codes .... 
   json.dumps(data, cls=NpEncoder)
   
   may work


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

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


Reply via email to