I got the following error : 'DataFrame' object has no attribute 'data'
"sklearn.datasets" is a scikit package, where it contains a method
  load_iris().


load_iris(), by default return an object which holds data, target and other members in it. In order to get actual values you have to read the data and target content itself.

Whereas 'iris.csv', holds feature and target together.


  FYI: If you set return_X_y as True in load_iris(), then you will directly get
  features and target.


from sklearn import datasets
data,target = datasets.load_iris(return_X_y=True)