如何在熊猫中合并相同的列名?

时间:2019-12-08 14:24:22

标签: python pandas

我有一个这样的数据框

Fruits  Destination
---------------------
Apple   Target
Orange  Source
Pineapple   Source
Berry   Target
Grape   Flip
Guva    Transform
Raspberry   Flip
Chikoo  Transform

在应用转置后,我想将行更改为列并将值分组。

Target  Source  Flip    Transform   Target  Source  Flip    Transform
---------------------------------------------------------------------
Apple   Orange  Raspberry   Chikoo  Berry   Pineapple   Grape   Guva

但是我的预期输出是

Target  Source    Flip      Transform
------------------------------------
Apple   Orange    Raspberry Chikoo
Berry   Pineapple Grape     Guva

如何实现?

0 个答案:

没有答案