学习中心
登录
已解决
绘制热力图的时候系数显示不完整

绘制热力图的时候,只有第一行显示数据,其余行无法显示,不知道是否是seabron和matplotlib的版本问题导致的

import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt

from scipy import stats

import warnings
warnings.filterwarnings("ignore") # 忽略警告

train_data = pd.read_csv("./zhengqi_train.txt",sep = '\t')
test_data = pd.read_csv("./zhengqi_test.txt",sep = '\t');

drop_col_kde = ["V5","V17","V28","V11","V9"]
train_data_drop = train_data.drop(drop_col_kde,axis =1)
# corr方法查看数据之间的相关性
train_corr = train_data_drop.corr()

ax = plt.subplots(figsize = (20,16))

# 绘制热力图,annot=True 显示系数
ax = sns.heatmap(train_corr,vmax = .8,square = True,annot = True,annot_kws={'fontsize': 8})

5b69ee28a5b30998e29164ddfad8e76b.png

44 1
    1个回答
    你还没有查看该回答的权限哦~请先获取查看权限
    立即查看
    写回答