1.5 Dealing with Missing Data
In
this tutorial we are talking about missing data. Missing data very common term
in data science or analytics and it happens datasets are sometimes not full or
there are some errors while it is being supplied or just basically that data
was not collected in the first place itself. So dealing with missing data is
important. we need to know what options we have and what approaches we can take
in order to fix that data, So, we will quickly have overview what exactly are
the options we have.
Dealing with Missing Data:-
- Predict with 100% accuracy
- For Example: City and State, if we know city then we can predict the state with 100% accuracy
- Leave the record as it
- If the field is not that much important, then we can leave the record as it is
- Remove the record entirely
- Sometimes, if you are missing some critical data, in that case you cannot restore the data then the only option left is to remove the record completely. The drawback here is that this analysis becomes less significant or has smaller that can have certain implications.
- Replace with mean or median
- This is very popular approach and we are going to see an example of this in our dataset. Mean is good option but usually median is preferred because median is less affected by outliers.
- Fill in by exploring correlations and similarities
- We can use this enhanced techniques to use explore regression and correlation to predict the missing variable.
- Introduce dummy variable for "Missingness"
- In this approach we actually introduce new variable where some data is missing, for example yes flag for missing and no flag not missing. Then explore the correlation of that variable with the outcome that you are looking for.
Let's
look at the dataset in csv format and see what data is missing in the same
- In the column Employees, missing data can be replaced with the industry median. Hence, we can just proxy it with the median of employees of Retail industry.
- In column Industry we can keep the record or remove it. We understand that Industry column is quite important for us, hence we will remove the record completely.
- The missing value in Inception column cannot be replaced with the median or mean of the same as it won't make sense, In our case it is not much of importance so that we can keep it as it is.
- Empty values in column state can be predicted easily based on the city. Similarly, expenses can be predicted using Revenue-Profit.
- We see that the line where Revenue, Expense, Profit and Growth is missing. We can proxy these values with the industry median.
Comments
Post a Comment