小编iqb*_*ved的帖子

尝试转动pandas数据帧时出现ReshapeError

在python 2.7.3上使用pandas 0.11我试图使用以下值来转动一个简单的数据帧:

    StudentID QuestionID Answer DateRecorded
0        1234        bar      a   2012/01/21
1        1234        foo      c   2012/01/22
2        4321        bop      a   2012/01/22
3        5678        bar      a   2012/01/24
4        8765        baz      b   2012/02/13
5        4321        baz      b   2012/02/15
6        8765        bop      b   2012/02/16
7        5678        bop      c   2012/03/15
8        5678        foo      a   2012/04/01
9        1234        baz      b   2012/04/11
10       8765        bar      a   2012/05/03
11       4321        bar      a   2012/05/04
12       5678        baz      c   2012/06/01
13       1234        bar      b   2012/11/01
Run Code Online (Sandbox Code Playgroud)

我使用以下命令:

 df.pivot(index='StudentID', columns='QuestionID') …
Run Code Online (Sandbox Code Playgroud)

pivot python-2.7 pandas

5
推荐指数
1
解决办法
2456
查看次数

标签 统计

pandas ×1

pivot ×1

python-2.7 ×1