- To access the observation variables, type:
iris.data
This outputs a NumPy array:
array([[ 5.1, 3.5, 1.4, 0.2], [ 4.9, 3. , 1.4, 0.2], [ 4.7, 3.2, 1.3, 0.2], #...rest of output suppressed because of length
- Let's examine the NumPy array:
iris.data.shape
This returns:
(150L, 4L)
This means that the data is 150 rows by 4 columns. Let's look at the first row:
iris.data[0]array([ 5.1, 3.5, 1.4, 0.2])
The NumPy array for the first row has four numbers.
- To determine what they mean, type:
iris.feature_names['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal width (cm)']
The feature or column names name the data. They are strings, and in this case, they correspond to dimensions in different ...