2017-07-28 46 views
-2
from sklearn import datasets 
iris=datasets.load_iris 
X = iris.data 
--------------------------------------------------------------------------- 
AttributeError       Traceback (most recent call last) 
<ipython-input-15-12a2d725131f> in <module>() 
----> 1 X = iris.data 

AttributeError: 'function' object has no attribute 'data 

I load iris dataset from sklearn ,but when i write "X = iris.data",an error occur as "AttributeError: 'function' object has no attribute 'data'" 
+1

你嘗試調用該函數? –

回答

2

load_iris是一個函數,需要被稱爲例如:

from sklearn import datasets 
iris=datasets.load_iris() 
X = iris.data 
+0

問題解決了,謝謝! –

相關問題