小编Vix*_*are的帖子

如何在Pandas DataFrame中移动列而不会丢失值

我想在Pandas DataFrame中移动一列,但是我没有找到一种方法来做到这一点而不会丢失值.(这篇文章非常类似于如何在Pandas DataFrame中移动一列,但经验证的答案没有给出所需的输出,我无法对其进行评论).有谁知道怎么做?

##    x1   x2
##0  206  214
##1  226  234
##2  245  253
##3  265  272
##4  283  291
Run Code Online (Sandbox Code Playgroud)

期望的输出:

##    x1   x2
##0  206  nan
##1  226  214
##2  245  234
##3  265  253
##4  283  271
##5  nan  291
Run Code Online (Sandbox Code Playgroud)

python dataframe pandas

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

标签 统计

dataframe ×1

pandas ×1

python ×1