Hello,

I am seeking a bit of help.

I need a fast way to transfer numpy arrays in json format.

Thus, converting array to list is not an option and I need something similar to:
a = np.ones(10000000)
%timeit a.tobytes()
17.6 ms
This is quick, fast and portable. In other words I am very happy with this, 
but...

Json does not support bytes.

Any method of subsequent conversion from bytes to string is number of times 
slower than the actual serialisation.

So my question is: Is there any way to serialise directly to string?

I remember there used to be 2 methods: tobytes and tostring. However, I see 
that tostring is deprecated and its functionality is equivalent to `tobytes`. 
Is it completely gone? Or is there a chance I can still find a performant 
version of converting to and back from `str` type of non-human readable form?

Regards,
DG

_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to