【发布时间】:2017-09-12 20:26:49
【问题描述】:
我想在具有以下条件的数据帧的特定列上应用反向填充:我认为“colum_A”只能假设四个值,称为 A、B、C、D,并且反向填充应该工作如下:
if the first not NaN is A, then backward_filling with A;
if the first not NaN is B, then backward_filling with B;
if the first not NaN is C, then backward_filling with B;
if the first not NaN is D, then backward_filling with C;
if the column_A only contains NaN, then backward_filling with D
例如:
输入 DF:
colum_A
NaN
NaN
B
B
C
C
输出DF:
colum_A
B
B
C
C
D
D
请,任何帮助将不胜感激。 此致, 卡罗
【问题讨论】: