1

If I have a data as given below , I need to fil the last observations based on the id when it last appeared, the data is as given below -

ID OpenDate ObsDate Amount ClosedDate Output

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 NaN NaN NaN NaN NaN

3 NaN NaN NaN NaN NaN

The expected output should be the filed out values FOR 1 AND 3 IDS with the previous values of 1 and 3 i.e

ID OpenDate ObsDate Amount ClosedDate Output

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

Consider this to be a dataframe,the inputs needed for python.

galaxy0208
  • 51
  • 6
  • It was answered here: https://stackoverflow.com/questions/47024931/how-to-fill-missing-dates-in-pandas-dataframe – algoquant Nov 21 '20 at 14:31

0 Answers0