我有一个示例数据框,如下所示:
{'Plan Date': {23186: nan,
18533: nan,
17980: nan,
28559: nan,
22587: 1572480000000000000,
22522: 1580428800000000000,
16639: 1572480000000000000,
14304: 1572480000000000000},
'Support Date': {23186: Timestamp('2020-12-31 00:00:00'),
18533: Timestamp('2022-03-31 00:00:00'),
17980: Timestamp('2022-03-31 00:00:00'),
28559: Timestamp('2019-02-28 00:00:00'),
22587: Timestamp('2019-07-31 00:00:00'),
22522: Timestamp('2019-07-31 00:00:00'),
16639: Timestamp('2019-10-31 00:00:00'),
14304: Timestamp('2019-10-31 00:00:00')},
'Plan Deadline': {23186: NaT,
18533: NaT,
17980: NaT,
28559: NaT,
22587: Timestamp('2019-10-31 00:00:00'),
22522: Timestamp('2020-01-31 00:00:00'),
16639: Timestamp('2019-10-31 00:00:00'),
14304: Timestamp('2019-10-31 00:00:00')}}
我想用同一数据框中其他列中最多2个日期填充计划日期列,前提是填充了计划截止日期列。使用np.where()非常复杂,我希望能找到一种更优雅、更高效的方法。