By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,002 Members | 1,171 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,002 IT Pros & Developers. It's quick & easy.

NameError: name 'zeros' is not defined

P: 1
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.

Regards,
Shravan
Mar 24 '08 #1
Share this Question
Share on Google+
1 Reply


jlm699
100+
P: 314
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.