empty fields to be filled with previous values

In the above sample data, I have empty fields and now the task is to fill the fields with previous values. my columns are dates and the values are a number of items present for that particular article for the specific date. which would be a faster way to interpolate the missing fields. Any suggestions to build the function is appreciated.

Topic numpy interpolation time-series pandas python

Category Data Science


You can use fillna function with ffill method:

df.fillna(method='ffill', inplace=True)

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.