470,636 Members | 1,431 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,636 developers. It's quick & easy.

NameError: name 'zeros' is not defined

Hello All,

I am newbie to python.

I was trying to use a=zeros(5) in python shell, but it is throwing the following exception in the shell

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'zeros' is not defined

My environment is
O/s : Ubuntu 7 (gutsy)
Python : 2.5.1

Could anyone tell me how to solve this problem?

Thank you very much well in advance.

Mar 24 '08 #1
1 26177
314 100+
I believe that zeros is a function that belongs to numpy (or Numeric?):

Expand|Select|Wrap|Line Numbers
  1. >>> import numpy
  2. >>> numpy.zeros(5, int)
  3. array([0, 0, 0, 0, 0])
Mar 24 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by jolly | last post: by
3 posts views Thread by willkab6 | last post: by
1 post views Thread by Korara | last post: by
reply views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.