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.

389959 (1) [Avatar] Offline
#1
Hi,
In chapter 9 , the code 9-2 , I find a line:
for splitVal in set(dataSet[:,featIndex]):
I am confused (since matrix can not convert to set , I think ) , and when I run it, a bug said TypeError: unhashable type: 'matrix'.

Then I change it to for splitVal in set(dataSet[:,featIndex].T.tolist()[0]):
There is also a bug: IndexError: index 0 is out of bounds for axis 0 with size 0

I think this sentence is just take the elements in the matrix to a set, so , how can I fix this problem?

Best,
Li