接下来
tutorial
,我使用前几条语句来显示iris数据的分布,如下所示
from sklearn.datasets import load_iris
from pandas import DataFrame
import numpy as np
iris = load_iris()
colors = ["blue", "red", "green"]
df = DataFrame(
data=np.c_[iris["data"], iris["target"]], columns=iris["feature_names"] + ["target"]
)
print (df)
df.boxplot(by="target", layout=(2, 2), figsize=(10, 10))
问题是,虽然
df
不是空的。
$ python3 pca_iris.py
sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) target
0 5.1 3.5 1.4 0.2 0.0
1 4.9 3.0 1.4 0.2 0.0
2 4.7 3.2 1.3 0.2 0.0
3 4.6 3.1 1.5 0.2 0.0
4 5.0 3.6 1.4 0.2 0.0
.. ... ... ... ... ...
145 6.7 3.0 5.2 2.3 2.0
146 6.3 2.5 5.0 1.9 2.0
147 6.5 3.0 5.2 2.0 2.0
148 6.2 3.4 5.4 2.3 2.0
149 5.9 3.0 5.1 1.8 2.0
[150 rows x 5 columns]
$
如何进行更多调试以了解boxplot的问题所在?