simple Numarray question

Hi, What do I have to include in my Python file for Python to recognize Numarray functions? For instance, in a file called hello.py I try: a = arange(10) print a[1:5] and I get the error: Traceback (most recent call last): File "C:\Python23\hello.py", line 3, in ? a = arange(10) NameError: name 'arange' is not defined Thank you, Nancy

Read point 6 of the Python Tutorial. Read chapter 2 (Installing NumPy) of Numeric Python manual. Hope this helps. Jon Saenz. | Tfno: +34 946012445 Depto. Fisica Aplicada II | Fax: +34 944648500 Facultad de Ciencias. \\ Universidad del Pais Vasco \\ Apdo. 644 \\ 48080 - Bilbao \\ SPAIN On Mon, 26 Jan 2004, Nancy Keuss wrote:
Hi,
What do I have to include in my Python file for Python to recognize Numarray functions? For instance, in a file called hello.py I try:
a = arange(10) print a[1:5]
and I get the error:
Traceback (most recent call last): File "C:\Python23\hello.py", line 3, in ? a = arange(10) NameError: name 'arange' is not defined
Thank you, Nancy
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion

On Mon, 2004-01-26 at 11:38, Nancy Keuss wrote:
Hi,
What do I have to include in my Python file for Python to recognize Numarray functions? For instance, in a file called hello.py I try:
a = arange(10) print a[1:5]
and I get the error:
Traceback (most recent call last): File "C:\Python23\hello.py", line 3, in ? a = arange(10) NameError: name 'arange' is not defined
There are a number of ways to import numarray (or any Python module), but the way I recommend is this: import numarray a = numarray.arange(10) print a[1:5] If you're writing quick scripts that you're not worried about maintaining, do this: from numarray import * a = arange(10) print a[1:5] If writing "numarray." is too tedious, but you still care about maintenance, try something like this: import numarray as _n a = _n.arange(10) print a[1:5] Todd
Thank you, Nancy
------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Numpy-discussion mailing list Numpy-discussion@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- Todd Miller <jmiller@stsci.edu>
participants (3)
-
Jon Saenz
-
Nancy Keuss
-
Todd Miller