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.

hawksley71 (3) [Avatar] Offline
#1
Using Python 3.5.3 and Listing 3.4 "Splitting the dataset into testing and training", I get the following error,
TypeError: slice indices must be integers or None or have an __index__ method
To get rid of the error I had to put "ratio * x_dataset.size" into an int() function, to look like this,

num_train = int(ratio * x_dataset.size)
Nishant Shukla (52) [Avatar] Offline
#2
You are absolutely correct! Fixed!

Thank you.