我有个问题: 我有数据(约30万行)
Date Column 1 Column 2 Column 3 Value
1/1/2017 A Jonas Station1 8
1/1/2017 A Greg Station1 5
1/1/2017 A Anton Station1 1
1/1/2017 B Jonas Station1 4
1/1/2017 B Greg Station1 4
1/1/2017 B Mick Station2 8
1/1/2017 B Anton Station3 7
1/1/2017 C Jonas Station4 2
1/1/2017 C Greg Station1 7
我需要计算下一步: 按日期,按第2栏,按第3栏: 我有个例子“格雷格”:
Date Column 1 Column 2 Column 3 Value
1/1/2017 A Greg Station1 5
1/1/2017 B Greg Station1 4
1/1/2017 C Greg Station1 7
对所有C/计数(A,B)求和,对于本例7/2=3.5 为每行添加值“3.5”。你知道吗
Date Column 1 Column 2 Column 3 Value
1/1/2017 A Greg Station1 5+3.5 = 8.5
1/1/2017 B Greg Station1 4+3.5 = 7.5
熊猫/Python是如何制作的? 更新:像“Greg”这样的物品我有~100天~500天和第1列、第2列~1k
用途:
使用自定义函数应更慢:
相关问题 更多 >
编程相关推荐