def cor_df(data, cols=None, xticklabels=False, yticklabels=False, close=True):
'''
??: ???????????
???:
data: ?????dataframe??
cols: ?????list??????data????
close: ????????
???:
cormat: ??????dataframe??
heatmap: ????fig??
'''
if cols is None:
cols=list(data.columns)
corrmat = data[cols].corr()
fig = plt.figure()
ax = fig.add_subplot(111)
sns.set(context='paper', font='monospace')
sns.heatmap(corrmat, vmax=0.8, square=True, ax=ax, xticklabels=xticklabels, yticklabels=yticklabels)
ax.set_title('Heatmap of Correlation Matrix')
if close:
plt.close('all')
return corrmat, fig
#Distribution
评论列表
文章目录