Hello Everybody,
Sorry if it's a trivial question. I'm trying to find out if there is a way to save object array to ascii file. numpy.savetxt() in NumPy V1.3.0 doesn't seem to work:
>>> import numpy as np
>>> obj_arr = np.zeros((2,), dtype=np.object)
>>> obj_arr[0] = np.array([[1,2,3], [4,5,6], [7,8,9]])
>>> obj_arr[1] = np.array([[10,11], [12,13]])
>>> obj_arr
array([[[1 2 3]
[4 5 6]
[7 8 9]], [[10 11]
[12 13]]], dtype=object)
>>> np.savetxt('obj_array.dat', obj_arr)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/numpy/lib/io.py", line 636, in savetxt
fh.write(format % tuple(row) + '\n')
TypeError: float argument required
>>>
scipy.io.savemat() supports Matlab format of the object array, but I could not find any documentation on ASCII file format for object arrays.
Thanks in advance,
Masha
--------------------
liukis(a)usc.edu