我有一个关于根据其他列的总和创建pandas数据帧的问题。
例如,我有这个数据框
Country | Accident
England Car
England Car
England Car
USA Car
USA Bike
USA Plane
Germany Car
Thailand Plane
我想再做一个基于国家所有事故总和的数据框。我们将不考虑事故的类型,而根据国家来总结。
我想要的数据帧是这样的
Country | Sum of Accidents
England 3
USA 3
Germany 1
Thailand 1
目前没有回答
相关问题 更多 >
编程相关推荐