我正试图重塑我之前融化的熊猫数据框。问题是在var_name部分重复了我希望作为列的名称。在
以下是目前的情况作为一个例子:
+-----------------+-----------+---------------+-----+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| Duration_survey | Q1_gender | Q2_age | ….. | Valdidation | categories | judgements |
+-----------------+-----------+---------------+-----+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
| 657 | Male | Older than 40 | | En la variedad hay placer. | Timing - First Click | 12.085 |
| 480 | Male | 31-40 | | en la variedad esta el placer | Timing - First Click | 10.777 |
| 657 | Male | Older than 40 | | En la variedad hay placer. | Timing - Last Click | 12.085 |
| 480 | Male | 31-40 | | en la variedad esta el placer | Timing - Last Click | 10.777 |
| 657 | Male | Older than 40 | | En la variedad hay placer. | Timing - Page Submit | 12.899 |
| 480 | Male | 31-40 | | en la variedad esta el placer | Timing - Page Submit | 11.906 |
| 657 | Male | Older than 40 | | En la variedad hay placer. | Timing - Click Count | 1 |
| 480 | Male | 31-40 | | en la variedad esta el placer | Timing - Click Count | 1 |
| 657 | Male | Older than 40 | | En la variedad hay placer. | Anyways, despite the urgency it’s fraught. Just check out media #twitter’s reaction to the ambiguity around who gets to spend this money. #cdnmedia #journalism | 8 |
| 480 | Male | 31-40 | | en la variedad esta el placer | Anyways, despite the urgency it’s fraught. Just check out media #twitter’s reaction to the ambiguity around who gets to spend this money. #cdnmedia #journalism | 7 |
+-----------------+-----------+---------------+-----+-------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+------------+
*请注意:这是一个简短的版本-如下面的代码所示,有更多的列。在
最后,我想在前面的例子的基础上得出这样的结论:
^{pr2}$*还有“分类”栏中的推文数量超过1000条。在
我以为我可以用pivot先把所有的tweet作为列,但是计时-第一次点击,计时-最后一次点击,计时-页面提交,计时-点击计数会得到我想要的形状,然后我只是再次融化它们,同时指定这4个与计时相关的列作为id,以保持其形状。但我还没走多远-旋转不起作用:
^{3}$所以这就是我失败的地方,它给了我一个错误。 ValueError:传递的值的长度是5202,索引意味着16
有人知道怎么解决这个问题吗?在
提前谢谢你
目前没有回答
相关问题 更多 >
编程相关推荐