I have a Pandas data frame with two sets of dates, a DatetimeIndex for the index and a column named date2 containing datetime objects, a value and an id. For some id's I am missing values where date2 is equal to the index, in this case I want to fill the row/values with the values of the previous DatetimeIndex and id's values. The date1 represents the current point in time, and date2 represents the last date. Each df[df.id == id] can be treated as its own dataframe however the data is stored in one giant dataframe 500k rows.

Example: Given

date2 id value index 2006-01-24 2006-01-26 3 3 2006-01-25 2006-01-26 1 1 2006-01-25 2006-01-26 2 2 2006-01-26 2006-01-26 2 2.1 2006-01-27 2006-02-26 4 4

In this example, were missing a index == date2 row for id 1, id 2 and for id3. I'd like to backfill each missing row with the previous index value respective to it's id.

I'd like to return: