[Numpy-discussion] Re: Converting array to string

2024-02-25 Thread Dom Grigonis
Does it have native bytes support? To me, it's either having fast conversion to `string` or data format with native bytes support. Sometimes readability is important, sometimes speed takes priority. Even with a good, unified data structure for arrays, indexed arrays, etc., it is always good to

[Numpy-discussion] Re: Converting array to string

2024-02-25 Thread Robert Kern
On Sun, Feb 25, 2024 at 1:52 PM Dom Grigonis wrote: > Thank you for your answer, > > Yeah, I was unsure if it ever existed in the first place. > > Space is less of an issue and something like `a.data.hex()` would be fine > as long as its speed was on par with `a.tobytes()`. However, it is 10x > s

[Numpy-discussion] Re: Converting array to string

2024-02-25 Thread Dom Grigonis
Thank you for your answer, Yeah, I was unsure if it ever existed in the first place. Space is less of an issue and something like `a.data.hex()` would be fine as long as its speed was on par with `a.tobytes()`. However, it is 10x slower on my machine. This e-mail is pretty much a final check (

[Numpy-discussion] Re: Converting array to string

2024-02-25 Thread Robert Kern
On Sat, Feb 24, 2024 at 7:17 PM Dom Grigonis wrote: > 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(1000)%timeit a.tobytes()17.6 ms >