Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/357.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在python中为熊猫的时间序列数据使用LOCF_Python_Locf - Fatal编程技术网

如何在python中为熊猫的时间序列数据使用LOCF

如何在python中为熊猫的时间序列数据使用LOCF,python,locf,Python,Locf,如果我有下面给出的数据,我需要根据上次出现时的id记录最后的观察结果,数据如下所示- ID OpenDate ObsDate金额ClosedDate输出 1 10-12-1990 15-08-1991 20 15-08-1992 2 3 10-12-1993 15-12-1993 25 15-08-1994 1 5 10-12-1995 25-11-1997 0 18-08-1998 1 1楠楠楠楠楠楠 3楠楠楠楠楠 预期输出应为1和3 ID的归档值,之前的值为1和3,即 ID OpenDate

如果我有下面给出的数据,我需要根据上次出现时的id记录最后的观察结果,数据如下所示-

ID OpenDate ObsDate金额ClosedDate输出

1 10-12-1990 15-08-1991 20 15-08-1992 2

3 10-12-1993 15-12-1993 25 15-08-1994 1

5 10-12-1995 25-11-1997 0 18-08-1998 1

1楠楠楠楠楠楠

3楠楠楠楠楠

预期输出应为1和3 ID的归档值,之前的值为1和3,即

ID OpenDate ObsDate金额ClosedDate输出

1 10-12-1990 15-08-1991 20 15-08-1992 2

3 10-12-1993 15-12-1993 25 15-08-1994 1

5 10-12-1995 25-11-1997 0 18-08-1998 1

1 10-12-1990 15-08-1991 20 15-08-1992 2

3 10-12-1993 15-12-1993 25 15-08-1994 1

假设这是一个数据帧,python所需的输入。

这里回答了:这里回答了: