[Numpy-discussion] Zeroing an existing array
Andrew P. Lentvorski, Jr.
bsder at allcaps.org
Wed May 14 13:19:04 CDT 2003
What is the official way to zero out an array in numarray/Numeric?
While I can create a new array of all zeros and then assign it to the old
variable, this is extremely wasteful of memory.
Currently, I am just using:
>>> import numarray
>>> a = numarray.arange(6)
>>> a
array([0, 1, 2, 3, 4, 5])
>>> a[:] = 0.0
>>> a
array([0, 0, 0, 0, 0, 0])
I looked through the manual for a function or array mathod which would
accomplish the same thing, but I didn't find an obvious one. Did I miss
something obvious?
Thanks,
-a
More information about the Numpy-discussion
mailing list