【发布时间】:2020-04-27 23:57:00
【问题描述】:
我的问题与我在 stackoverflow 上发布的另一个问题有关:Pandas: How can I check multiple columns if there are any values that are smaller than previous value?。
现在我知道在我的数据框中有多个值小于之前的值,我想用之前的值替换那个值。
示例数据集:
c d e
0 3 5 8
1 1 5 8
2 5 6 8
3 6 7 8
4 2 1 9
5 9 3 3
想要的结果:
c d e
0 3 5 8
1 3 5 8
2 5 6 8
3 6 7 8
4 6 7 9
5 9 3 9
有没有什么方法可以用简单的 Python/Panda 代码行来完成这项任务?
【问题讨论】:
-
您能否更具体地说明问题所在?请参阅How to Ask、help center。另外,你能以更方便的格式分享样本数据吗?