How To Fill Missing Dates In Pandas Dataframe?
MY DataFrame contains several data for each date. in my date column date has entered only for the first data of the day, for rest of the data of the day there is only sparse value.
Solution 1:
In Python
df['Date']=df['Date'].replace({'':np.nan}).ffill()
In R
library(zoo)
df$Date[df$Date=='']=NA
df$Date=na.locf(df$Date)
Post a Comment for "How To Fill Missing Dates In Pandas Dataframe?"