pandas groupby得到错误结果

时间:2017-09-10 12:10:53

标签: pandas pandas-groupby

数据帧:

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

为什么金额不为零?我怎样才能得到正确的结果?

0 个答案:

没有答案