I have a dataframe of 2 months of data with 20 columns, one of which is 'date' .
There are 3 non-consecutive dates on which there is no data.
I want to replicate previous day's data to create entries for those missing days as well.
Here is what I tried:
df_replicate=df[(df['date']=='2021-07-27') | (df['date']=='2021-08-18') | (df['date']=='2021-08-22')]
df_replicate.loc[df_replicate['date']=='2021-07-27']='2021-07-28'
df_replicate.loc[df_replicate['date']=='2021-08-18']='2021-08-19'
df_replicate.loc[df_replicate['date']=='2021-08-22']='2021-08-23'
And then concatenate df and df_replicate
What is an easier way to do this?