1、如果索引中有空置,pandas不会计算该条数据,并忽视该条数据,因此可能导致数据缺失、
个人解决方法:
for k in indexTable: rightTable[k].fillna('这是空值',inplace=True)
用循环填充索引的空值
2、pivot_table(index='行标签',values='求和项',aggfunc=np.sum)
求和项标签报错'Series' object has no attribute 'columns'
个人解决方案:
Table['求和项'] = pd.to_numeric(Table['求和项'],errors='coerce')
将参数转换为数字类型默认返回为float64或int64