To be continued(自用)
今天在处理数据的时候,得到一个包含缺失值个数的series,想把其中缺失个数大于某个数的索引提取出来
其实完全不用这么写
说明不能只是[df_1.isnull().sum().sort_values(ascending=False).values]>70
而是要构造一个形状一致全为70的列表
na_cate = df_1.isnull().sum().sort_values(ascending=False)
na_cate
F2-GrayLevelCooccurenceMatrix39-7Correlation 84
F2-GrayLevelCooccurenceMatrix39-7InformationMeasureCorr1 84
F2-GrayLevelCooccurenceMatrix39-7Entropy 83
F2-GrayLevelCooccurenceMatrix39-7InformationMeasureCorr2 83
F2-GrayLevelCooccurenceMatrix39-7SumVariance 83
..
F2-GrayLevelCooccurenceMatrix37-1InverseDiffMomentNorm 0
F2-GrayLevelCooccurenceMatrix37-4InverseDiffMomentNorm 0
F2-GrayLevelCooccurenceMatrix37-7InverseDiffMomentNorm 0
F2-GrayLevelCooccurenceMatrix38-1InverseDiffMomentNorm 0
ID 0
Length: 1426, dtype: int64
delete_columns_list = na_cate[na_cate.values>70].index.tolist()
len(delete_columns_list)
63
df_1.drop(delete_columns_list,axis=1)
网友评论