数据帧:
data = {"Category":["Resource","Resource","Resource","Resource"],
"Item1":["Bandwidth","Bandwidth","Bandwidth","Bandwidth"],
"Item2":["DC","OC","DC","OC"],
"Amount":[156.415,396.921,-156.415,-396.921]}
df = pd.DataFrame(data)
df = df.groupby(["Category","Item1"],as_index=False).sum()
print df
得到结果:
Category Item1 Amount
0 Resource Bandwidth 5.684342e-14
为什么金额不为零?我怎样才能得到正确的结果?