数据集来源: http://archive.ics.UCI.edu/ml/datasets/wine quality
引用说明
P. Cortez,A. Cerdeira,F. Almeida,T. Matos and J. Reis。
modelingwinepreferencesbydataminingfromphysicochemicalproperties
In Decision Support Systems,Elsevier,47(4) :547-553.ISSN :0167-9236。
使用的python库: numpypandasmatplotlibseabornseaborn封装在基于matplotlib的上面,便于直接传递参数调用
数据集说明
包含红葡萄酒和白葡萄酒两个数据集
winequality-red.csv
winequality-white.csv
实例数: red wine -1599 white wine-4898
属性(特征)数: 11输出属性
输入变量(基于物理化学测试) )
1 -固定酸度
2 - volatile acidity挥发性酸度
3-辅酶d柠檬酸
4 - residual sugar残糖
5 -乙基氯化物
6 - free sulfur dioxide游离二氧化硫
7 -总sulfur dioxide总二氧化硫
8 -密度
9 - pH PH值
10 - sulphates硫酸盐
11 -酒精
输出变量(基于感官数据) :
12 -质量(score between0and 10 ) )。
使用jupyter notebook
`
读取数据
df=PD.read _ CSV (wine quality-red.CSV ) )
查看dataframe的前10行
查看数据信息
单变量数据分析
简单的数据统计
df.columns返回数据帧的列标签
colmn=df.columns.tolist ()将从dataframe返回的列标签转换为列表
fig=PLT.figure (fig size=(10,6 ) )
forIinrange(12 ) :
PLT.subplot (2,6,i 1 ) )。
SnS.boxplot(df[colmn[I],orient='v ',width=0.5,color=color[0] ) )
PLT.ylabel(colmn[I],fontsize=12 ) )。
plt.tight_layout (
# print (图像1:通用布局) )。
`