[Numpy-discussion] array not appending
Thu Dec 18 04:44:39 CST 2008
Prashant Saxena wrote:
> ST = np.empty((), dtype=np.float32)
> ST = np.append(ST, 10.0)
> This works, is it proper way to do so?
> One more prob
> ST.size returns 2.
> Why? I have added only one element.
You added one element to an array which as already one element. Empty
does not mean that the array has no items (which is not possible AFAIK),
but that the values are 'empty' (more exactly, they are undefined
values, since the memory emplacement has not been initialized).
More information about the Numpy-discussion