相关疑难解决方法(0)

如何在没有索引的情况下在pandas中转置数据帧?

很确定这很简单.

我正在阅读一个csv文件并拥有数据帧:

Attribute    A   B   C
a            1   4   7
b            2   5   8
c            3   6   9
Run Code Online (Sandbox Code Playgroud)

我想做一个转置来获得

Attribute    a   b   c
A            1   2   3
B            4   5   6
C            7   8   9
Run Code Online (Sandbox Code Playgroud)

但是,当我做df.T时,它会导致

             0   1   2 
Attribute    a   b   c
A            1   2   3
B            4   5   6
C            7   8   9`
Run Code Online (Sandbox Code Playgroud)

如何摆脱顶部的索引?

python dataframe pandas

28
推荐指数
2
解决办法
6万
查看次数

标签 统计

dataframe ×1

pandas ×1

python ×1