My original data set shape is (790215,20) which contains features that have around 60-80% missing values. I decided to use scikit-learn's KNNImputer as follows
import pandas as pd
from sklearn.impute import KNNImputer
# Loading the data
dataset = pd.read_csv('Dataset.csv')
# To avoid 'MemoryError' imputing individually
#Loading the first feature
X = dataset.iloc[:,0].values
#Imputing with default parameters
imputer = KNNImputer()
#Reshaping to meet the dimensional requirement
X_imp = imputer.fit_transform(X.reshape(1,-1))
Now the shape of X_imp is (1,729026)
I'm not sure what I did wrong. Why the 790215 changed to 729026.
Update :
The X.shape is (790215,)
X.reshape(1,-1).shape is (1,790215)
X.reshape(1,-1) is array([[ nan, 97., 89., ..., 140., 120., 115.]])