[Numpy-discussion] array not appending

Prashant Saxena animator333 at yahoo.com
Thu Dec 18 05:56:05 EST 2008


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.

Prashant




________________________________
From: Gael Varoquaux <gael.varoquaux at normalesup.org>
To: Discussion of Numerical Python <numpy-discussion at scipy.org>
Sent: Thursday, 18 December, 2008 4:20:49 PM
Subject: Re: [Numpy-discussion] array not appending

On Thu, Dec 18, 2008 at 04:19:20PM +0530, Prashant Saxena wrote:
>    How do I solve this?

If you want appending in place you have to use a python list. If you don't
need modification in place, np.append returns an array with the appended
number.

Gaël
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at scipy.org
http://projects.scipy..org/mailman/listinfo/numpy-discussion



      Add more friends to your messenger and enjoy! Go to http://messenger.yahoo.com/invite/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20081218/2b95d9ff/attachment.html>


More information about the NumPy-Discussion mailing list