from sklearn.datasets import load_iris
iris = load_iris()
print(iris.feature_names)
print(iris.target_names)
print(iris.data[0])
print(dir(iris))
Output in terminal -
['sepal length (cm)', 'sepal width (cm)', 'petal length (cm)', 'petal width (cm)']
['setosa' 'versicolor' 'virginica']
[5.1 3.5 1.4 0.2]
['DESCR', 'data', 'feature_names', 'target', 'target_names']
$ pylint scikitlearn.py
No config file found, using default configuration
************* Module scikitlearn
C: 8, 0: Final newline missing (missing-final-newline)
C: 1, 0: Missing module docstring (missing-docstring)
C: 3, 0: Constant name "iris" doesn't conform to UPPER_CASE naming style (invalid-name)
E: 4, 6: Instance of 'tuple' has no 'feature_names' member (no-member)
E: 5, 6: Instance of 'tuple' has no 'target_names' member (no-member)
E: 6, 6: Instance of 'tuple' has no 'data' member (no-member)
----------------------------------------------------------------------
Your code has been rated at -20.00/10 (previous run: -15.00/10, -5.00)`
Pylint displaying a false positive for the above code
$ pylint --version
No config file found, using default configuration
pylint 1.8.4,
astroid 1.6.2
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
Thanks for the issue, I can reproduce it. I'm not sure why pylint considers the return of load_iris to be a tuple instead of a Bunch object, but we could probably fix it with an astroid brain tip.
thanx for fix
iris = datasets.load_iris()
X = iris.data
y = iris.target
class_names = iris.target_names
print(class_names)
df = pd.DataFrame(X, columns=iris.feature_names)
print(df.head())
print(df.describe())
@maxkleiner This is currently not fixed, the issue is still present.
@maxkleiner
Please use
X = iris["data"]
Y = iris["target"]
@yogendrabagoriya Thank you for the solution!
Most helpful comment
@maxkleiner
Please use
X = iris["data"]
Y = iris["target"]