from sklearn.preprocessing import Imputer
imp = Imputer(missing_values='NaN', strategy='mean', axis=0)
imp.fit(train)
train_imp = imp.transform(train)
How to get SVMs to play nicely with missing data in scikit-learn?