Methods for dealing with missing values in time-series data
When working with time series, we often find missing data; the missing value is caused by sensors that have been disconnected or a data reader or recorder that has failed.
Within pandas library, there are few methods available to solve the missing value.
Let’s import the required libraries
input data frame
The following code displays data frame which contain some missing value
isna().sum() returns the summary of missing value in each column
Handling missing value by replacing the new value
when using the ffill method, the previous value is used to fill in the NaN value. Backward fill, on the other hand, is done with bfill, which used the next value to fill in.
Lastly, the interpolation method is particularly useful for data that is presented in a sequential or time-series format.
This post has shown the very basic method of filling missing data by using ffill, bfill and interpolation that useful for time-series imputation.
Thank you for reading till the end.