I am trying to learn scikit learn (sklearn). Following is a part of code trying to create a data frame with statsmodels.api from iris dataset.
But I'm not sure how the for loop works and the datatypes of iris.target_names[x]
& target
from sci-kit. Can anyone please explain?
from sklearn import datasets ## Get dataset from sklearn
## Import the dataset from sklearn.datasets
iris = datasets.load_iris()
## Create a data frame from the dictionary
species = [iris.target_names[x] for x in iris.target]