将特定行转换为熊猫中的列

时间:2021-01-10 00:28:14

标签: python pandas dataframe numpy

我有一个包含以下信息的数据集:

Title                         Year                 Revenue (Mi)
---------------------------------------------------------------
Guardians of the Galaxy       2015                   313.13
Split                         2016                   138.0
Sing                          2016                   270.32
Moana                         2015                   248.02

我想把这段数据转换成这样的形式:

Title                        2015                      2016
------------------------------------------------------------
Guardians of the Galaxy     313.13
Split                                                 138.02
Sing                                                  270.32
Moana                       248.02

如何将我的数据框转换为这种形式?我不明白在这种情况下我该怎么做。

1 个答案:

答案 0 :(得分:2)

试试

<handle not found 2>
three
./function_command_exists.sh: 34: ./function_command_exists.sh: command-that-does-not-exist: not found
<handle not found 4>
ls: cannot access 'non-existing-path': No such file or directory
<handle other error 5>