Pandas pivot produces quot;ValueError: Index contains duplicate entries, cannot reshapequot;(Pandas pivot 产生“ValueError:索引包含重复的条目,无法重塑;)
问题描述
我有一个格式如下的熊猫表:
I have a pandas table formatted as following:
我需要创建一个这样的视图,将其旋转成这样:
I need to create a view of this that pivots it to sth like this:
这是我的代码:
我收到以下错误:
如何处理?
推荐答案
试试pivot_table
:
这篇关于Pandas pivot 产生“ValueError:索引包含重复的条目,无法重塑";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!