标签:font param mat 相关性 and import matrix tle set
import pandas as pd
df2=pd.read_excel(‘./data/data2.xlsx‘,index_col=‘产品编码‘)
df2.head()
x=df2[‘供应商进货价‘]
y=df2[‘销售价‘]
from pylab import mpl
mpl.rcParams[‘font.sans-serif‘]=[‘FangSong‘]
#散点图
import matplotlib.pyplot as plt
fig,ax=plt.subplots()
ax.scatter(x,y,color=‘green‘)
ax.set(xlabel=‘供应商进货价‘,ylabel=‘销售价‘,title=‘销售情况分析‘)
plt.show()
#散点矩阵
from pandas.plotting import scatter_matrix
scatter_matrix(df2,figsize=(10,10),marker=‘o‘,alpha=0.5)
plt.show()
#相关系数
df2.corr()
df2[‘销售价‘].corr(df2[‘供应商进货价‘])
标签:font param mat 相关性 and import matrix tle set
原文地址:https://www.cnblogs.com/tiankong-blue/p/11620612.html