[Numpy-discussion] Need **working** code example of 2-D arrays
John Hunter
jdh2358@gmail....
Mon Oct 13 15:04:06 CDT 2008
On Mon, Oct 13, 2008 at 2:29 PM, Alan G Isaac <aisaac@american.edu> wrote:
> The problem is, you did not just ask
> for technical information. You also
> accused people of being condescending
> and demeaning. But nobody was
> condescending or demeaning. As several
> people **politely** explained to you,
> you are wrong about that.
Here is a simple example of loading some 2D data into an array and
manipulating the contents
import numpy as np
# load a 2D array of integers
X = np.loadtxt('somefile.txt').astype(int)
print X.shape # X is a 2D array
# display the contents of X as a string
print '\n'.join([''.join([chr(c) for c in row]) for row in X])
The input file "somefile.txt" is attached
JDH
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: somefile.txt
Url: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20081013/9ea9e741/attachment-0001.txt
More information about the Numpy-discussion
mailing list