2019-03-21
阅读量:
1051
pandas透视表
Pandas可以用来创建 Excel式的透视表。例如,“LoanAmount”这个重要的列有缺失值。我们可以用根据 ‘Gender’、‘Married’、‘Self_Employed’分组后的各组的均值来替换缺失值。每个组的 ‘LoanAmount’可以用如下方法确定:
#Determine pivot table
impute_grps = data.pivot_table(values=["LoanAmount"], index=["Gender","Married","Self_Employed"], aggfunc=np.mean)
print impute_grps
74.9547
1
4
关注作者
收藏
评论(0)
发表评论
暂无数据

