[PYTHON MATRIX-SIG] arrays from text?
Jim Phillips
jim@ks.uiuc.edu
Thu, 24 Oct 96 19:19:29 -0500
Hi,
Is there a way to (quickly) generate an array of numbers from an array of
their string representations? More specifically, if I have an array a of Char
in which each row contains a printed representation of a Float, is there a
faster way to get an array of Floats than the following?
array(map(lambda b: string.atof(b.tostring()), a))
Wouldn't it be nice if there were? ;-)
Even better would be the ability to use the equivalent of FORTRAN format
statements and implicit loops to read in several arrays of different types
simultaneously from either a Char array or a file. Anyone know how hard this
would be to do?
Of course, the reason for doing this is that with array operations as fast as
they are, the bottleneck in many programs will be the time needed to read in
text files, which won't be any faster.
-Jim Phillips
jim@ks.uiuc.edu
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================