Deleting Null Values in data analysis Python I have recently been looking through an Ipython notebook that analyzes the Iris dataset. At one point in the notebook I read the following:

I'm confused about this statement. Why would delteing these 5 rows bias our results, and how would mean imputation help with this?
Thanks
 A: It could bias the analysis in the sense that the other columns (which are not null) would be taken away from statistics, since all the rows would be deleted.
Since it is clear that the NaN entries affect all Iris-Setosa rows, it would make no sense to sacrifice all the other columns because one of the does not apply for this qualitative class. A better approach is to change all NaN entries for Iris-Setosa rows with the mean for that column (a.k.a Mean Inputation), which has the consequence of not changing the mean for that column, preserving the statistic for the other rows.
A: If missingness depends on the unobserved missing values, then just deleting such records tends to obscure important information (imagine that only records without a perfect correlation between variables have missings, then a correlation will look stronger without these values).
Mean imputation is generally a terrible idea and should not be used. Better alternatives include things like multiple imputation, taking values from records that are somehow similar etc., which of course makes assumptions, but at least those are more plausible than the incredibly strong and implausible assumptions you would require for deleting the records or mean imputation to be valid approaches. 
A: As stated in the cited text, all of the missing values belong to the same column for the same  class, Iris Setosa. This hints at a possible systematic error in the data collection/entry method, which could mean that even more of these values are missing.
Why would deleting these rows bias our results?
If we just outright delete these data points, we're throwing away information. Because these values all belong to the same class, tossing these rows away could result in a class imbalance problem. Additionally, we lose the information about the Iris Setosa class provided by the other columns. Furthermore, the fact that this error appears systematically propagated could prove useful in analysis.
How would mean imputation help with this?
Imputing these values using the mean value for the class ameliorates the above listed issues: we maintain the information provided by the other columns and don't upset the class balance of the dataset.
Mean imputation also provides some other benefits:


*

*The sample mean for that class response is left unchanged.

*It's easy.

*The sample size remains the same.
However, it should be noted that mean imputation reduces measures of dispersion in the dataset, and is not ideal for multivariate problems; much better imputation solutions exist.
