小编Sha*_* H.的帖子

如何根据python中的位置将1列数据框转换为3

我需要使用python将1列转换为3列。我的数据是数据帧类型

My data is:

0 1321.1321
1 text1
2 321113
0 1426.2156
1 text2
2 145454
Run Code Online (Sandbox Code Playgroud)

我想以以下格式接收它:

col1         col2   col3 
1321.1321    text1  321113
1426.2156    text2  145454
Run Code Online (Sandbox Code Playgroud)

我尝试使用枢轴,重塑形状,但没有一个可以提供所需的解决方案

My data is:

0 1321.1321
1 text1
2 321113
0 1426.2156
1 text2
2 145454
Run Code Online (Sandbox Code Playgroud)

我想以以下格式接收它:

col1         col2   col3 
1321.1321    text1  321113
1426.2156    text2  145454


col1         col2   col3 
1321.1321    
             text1  
                    321113
1426.2156    
             text2  
                    145454
Run Code Online (Sandbox Code Playgroud)

python pandas

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

标签 统计

pandas ×1

python ×1