赞
踩
- #缺失值的展示
- def plot_missing(df):
- # 对缺失值列进行计数
- missing = df.isnull().sum()
- missing = missing[missing > 0]
- #missing.sort_values(inplace=True)
-
- # 通过计数绘制缺失值
- missing.plot.bar(figsize=(12,8))
- plt.xlabel('Columns with missing values')
- plt.ylabel('Count')
-
- # 缺失值可视化库
- import missingno as msno
- msno.matrix(df=df, figsize=(16,8), color=(0,0.2,1))
-
- plot_missing(train_data)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。