Is there a way to save a structured array in a text file?
My problem is not so much in the saving procedure, but rather in the
'reloading' procedure.
See below
In [3]: import numpy as np
In [4]: r = np.ones(3,dtype=[('name', '|S5'), ('foo', 'i8'), ('bar', 'f8')])
In [5]:
On 23 Jan 2012, at 21:15, Emmanuel Mayssat wrote:
Is there a way to save a structured array in a text file?
My problem is not so much in the saving procedure, but rather in the
'reloading' procedure.
See below
In [3]: import numpy as np
In [4]: r = np.ones(3,dtype=[('name', '|S5'),
On 23 Jan 2012, at 22:07, Derek Homeier wrote:
In [4]: r = np.ones(3,dtype=[('name', '|S5'), ('foo', 'i8'), ('bar',
'f8')])
In [5]: r.tofile('toto.txt',sep='\n')
bash-4.2$ cat toto.txt
('1', 1, 1.0)
('1', 1, 1.0)
('1', 1, 1.0)
cnv = {0: lambda s: s.lstrip('('), -1: lambda s: