Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个单行的熊猫数据框:
10 20 30 70 data1: 2.3 5 6 7
我想重新索引框架,以便列值(10、20、30、70)成为索引值,数据成为列:
data1: 10 2.3 20 5.0 30 6.0 70 7.0
我如何实现这一目标?
您正在寻找转置( T) 方法:
T
In [11]: df Out[11]: 10 20 30 70 data1: 2.3 5 6 7 In [12]: df.T Out[12]: data1: 10 2.3 20 5.0 30 6.0 70 7.0