I have installed python 2.3.3 on my windows machine have have ran
several programs succesfully. I have also installed numarray 1.1 for
my version of python and am now trying to create arrays using the
array command, eg Import Numeric a = array([1, 2, 3])
Traceback (most recent call last):
File "<pyshell#1 >", line 1, in -toplevel-
a = array([1, 2, 3])
NameError: name 'array' is not defined
if I just enter
Import Numeric
I get
indicating that numarray is installed correctly.
What am I doing wrong?
Thanks in advance
Ben 4 3143
> if I just enter Import Numeric I get
indicating that numarray is installed correctly.
What am I doing wrong?
I doubt that that works. "Import" won't do it - it yields a syntax error.
What you meant is
import Numarray
But you have to keep in mind that importing a module that way will not put
it in the global namespace. So you have to qualify function names:
Numarray.array
Or you import them using the "from" syntax, which will bind the Numarray
names in the global namespace:
from Numarray import *
--
Regards,
Diez B. Roggisch
Diez B. Roggisch wrote: if I just enter
>Import Numeric
I get
indicating that numarray is installed correctly.
What am I doing wrong?
I doubt that that works. "Import" won't do it - it yields a syntax error.
What you meant is
import Numarray
Actually,
import numarray
Note the case. In addition,
import Numeric
will import Numeric, not numarray. But otherwise, Diez is correct.
--
Robert Kern rk***@ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Ben Champion wrote: I have installed python 2.3.3 on my windows machine have have ran several programs succesfully. I have also installed numarray 1.1 for my version of python and am now trying to create arrays using the array command, eg
Import Numeric a = array([1, 2, 3])
These are two different modules: numarray is one, and Numeric is the
other. If you installed numarray, you should use:
import numarray
Also note the lowercase 'import'.
As another poster pointed out, the 'array' function is not in the global
namespace. You have to use:
a = numarray.array([1,2,3])
Or alternatively:
from numarray import * a = array([1,2,3])
What I usually do, since Numeric and numarray are mostly compatible is:
try:
import numarray as N
except ImportError:
import Numeric as N
a = N.array([1,2,3])
This way you'll use numarray if it is available, otherwise you fallback
to Numeric.
> Actually,
import numarray
Note the case. In addition,
import Numeric
will import Numeric, not numarray. But otherwise, Diez is correct.
I actually _used_ Numeric as that is what is installed on my machine :) So I
couldn't verify that Numarray is not working...
--
Regards,
Diez B. Roggisch This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: RJS |
last post by:
Hi all,
I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32-
py2.2).
Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222.
In the sample below, commenting out "import numarray" allows the exe to
run. Left in, I get "4.exe has generated errors" etc.
I'm going around and around and there isn't much on Google.
py2exe output is last.
|
by: Alexander Schwaigkofler |
last post by:
Hi!
I have the following problem with numarray. I read the install.txt manual,
but it doesn't already work.
OS: Microsoft Windows 2000
python: Python 2.2.3 (#42, May 30 2003, 18:12:08) on
win32
numarray: Version 0.7
the output from the installation (by hand) you can see below:
|
by: Marco Bubke |
last post by:
Hi
I have tried to include numarray in Pyrex but I get allways
this error:
Traceback (most recent call last):
File "gears.py", line 9, in ?
import gl
File "/home/marco/projects/test_pyrex/gl.pyx", line 40, in gl
ctypedef class numarray.NumArray :
|
by: Marco Bubke |
last post by:
Hi
Ok, I get a reproduceable seqmentation fault.
Ok, fist the code:
cdef NumArray array_to_double(NumArray array):
# maybe here is memoty leak!
cdef NumArray flat_array_obj
flat_array_obj = NA_InputArray(NA_updateDataPtr(array), tFloat64,
|
by: Marc Schellens |
last post by:
Following the NumPy documentation, I took over some C code,
but run into an error.
Does anybody have a suggestion?
Thanks,
marc
gdlpython.cpp:225: `PyArray_Type' undeclared (first use this function)
#include <python2.3/Python.h>
| |
by: SunX |
last post by:
I tried to initialize a float point array by:
import numarray
xur = numarray.fromfunction(lambda x,y,z:x*y*z, (2, 2, 2))
but I ended up with an integer array even though x, y, and z are all floats.
BTW, how do you unzip NumTut in windows? And is there a newer version?
Thank you
|
by: Mizrandir |
last post by:
I'd like to subclass numarray's array. I'd like to add some methods
and override others like __init__. I don't know how to do this and
haven't found help searching the manual or the web, can someone help?
For example imagine I just want to do something as simple as making a
subclass "NewClass" with the __init__ method overridden so that the
behaviour would be:
>>> a = NewClass(2)
>>> print a
|
by: andrewfelch |
last post by:
Below is the code to/from Boolean arrays and Unsigned integers. On my
Pentium 4, functions such as "bitwise_and" are 32 times faster when run
on 32-bit integers instead of the entire-byte-consuming-Boolean.
Good luck all:-)
uint32Mask =
numarray.array(, numarray.UInt32)
uint32MaskInner = numarray.copy.deepcopy(uint32Mask)
uint32MaskInner.shape =
|
by: Bryan |
last post by:
hi,
what is the difference among numeric, numpy and numarray? i'm going to start
using matplotlib soon and i'm not sure which one i should use.
this page says, "Numarray is a re-implementation of an older Python array module
called Numeric"
http://www.stsci.edu/resources/software_hardware/numarray
|
by: robert |
last post by:
just a note - some speed comparisons :
0.60627370238398726
0.42836673376223189
0.36965815487747022
0.016557970357098384
0.15692469294117473
0.01951756438393204
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |