The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

sdebeer (2) [Avatar] Offline
#1
When I try to use the code on page 28:
ax.scatter(datingDataMat[:,1], datingDataMat[:,2],15.0*array(datingLabels), 15.0*array(datingLabels))

I get the error:
File "<stdin>", line 1, in <module>
NameError: name 'array' is not defined

All previous code works just fine. Can anyone help me?
peter.harrington (82) [Avatar] Offline
#2
Re: Array error code pag. 28
I believe your python shell does not know what array() means:

Can you please try doing:
>>>from numpy import *
first and then see if you still get the error?

You should use this command each time you open a python shell for the examples in this book.
sdebeer (2) [Avatar] Offline
#3
Re: Array error code pag. 28
Thank you Peter! That did the job smilie