Hi,
in Listing 2.1. Interrogating the Iris dataset in scikit-learn (interactive shell)
When trying to reproduce (with full up-to-date ipython) the code, the
np.array(zip(iris.data,iris.target))[0:10] line fails with this message:
IndexError: too many indices for array
The problem is that np.array creates a 1 dimension array with the zipped object instead of iterating through it to create the desired array.
In order to get the desired behaviour, I had to create a list from the zip object first
np.array(list(zip(iris.data,iris.target)))[0:10]
This is my first dip into numpy, so it might be something due to an update in the library since the book was released
|