这可能是一个简单的例子,但是我整天都没有运气
我有一个看起来像这样的表:
event user country plan
start fred uk free
start fred uk free
start john fr paid
stop john fr paid
stop fred uk free
scan john fr paid
scan fred uk free
scan fred uk free
stop john fr paid
start john fr paid
Id希望将其转换为此:
event
user start stop scan country plan
fred 2 1 2 uk free
John 2 2 1 fr paid
有人可以帮忙吗?我已经尝试过透视,但它一直告诉我:ValueError:索引包含重复的条目,无法重塑
谢谢