[Tutor] Using numpy Array Capabilities
Wayne Watson
sierra_mtnview at sbcglobal.net
Mon Apr 13 02:54:09 CEST 2009
I'm pretty sure numpy can manipulate arrays, but I'm barely familiar
with it. Basically, what I would like to do is to take a list like:
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
and convert it to;
[['0x0', '0x1', '0x2', '0x3', '0x4'], ['0x5', '0x6', '0x7', '0x8', '0x9']]
That is, it becomes a matrix of 2 rows and 5 columns. I generated the
above from a loop in Python, and generated hex equivalents in the last
list. Can numpy do this simply without resorting to loops? How would
one code it?
I think numpy produces an array like object, but it's not necessarily
the same as Python. However, the numpy arrays are going to be input into
an object that expects numpy arrays.
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
All the neutrons, and protons in the human body occupy
a cube whose is 5.52*10**-6 meters. That adds up to a
150 pound person. It's not a surprise that we are mostly
space. (Calculation by WTW)
More information about the Tutor
mailing list