From various resources, I came to know that Imputation using Expectation Maximization method is better than Mean Imputation for imputing missing data . But no source have explained how to implement it in python.
I looked into scikit-learn , fancyimpute packages, but they have not mentioned anything about Expectation Maximization method.
It would be very helpful , if you can provide link to documentation which explain implementation with example, or provide code to implement Expectation Maximization method for missing data.
import impyute as impy
data_missing = pd.DataFrame(np.array([[np.NaN, 0.6, np.NaN], [np.NaN, 0.25,
0.3], [0.6, 0.7, np.NaN]]), columns=['a', 'b', 'c'])
em_imputed = impy.em(data_missing)
output:
a b c
0 0.6 0.60 0.3
1 0.6 0.25 0.3
2 0.6 0.70 0.3
em function will return dataframe type
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.