[Numpy-discussion] printing array in tabular form
heng at cantab.net
Wed May 8 02:53:45 EDT 2013
On Wed, 2013-05-08 at 10:13 +0800, Sudheer Joseph wrote:
> However I get below error. Please tell me if any thing I am missing.
> file "read_reg_grd.py", line 22, in <module>
> np.savetxt("file.txt", IL.reshape(-1,5), fmt='%5d', delimiter=',')
> AttributeError: 'list' object has no attribute 'reshape'
IL is a list, not a numpy array. You can either convert the list to an
array after you've filled it, using np.array(IL), or you can
pre-allocate the array and fill it directly in the loop.
More information about the NumPy-Discussion