I am using the IterativeImputer from sklearn and I notice that it changes the data shape. Initially I have an (X,5) array where all columns except for the last one contain the missing value (which has been given as the missing value to the imputer). At the end the output array which is only (X,1) and specifically keeping the last column where the only real data exist. I would expect to return an (X,5) array. What could be wrong? Probably I am missing something but I do not see it...
import numpy as np from sklearn.experimental import enable_iterative_imputer from sklearn.impute import IterativeImputer missing_value = -999 imputer = IterativeImputer(missing_values=missing_value) aa = [[-999, -999, -999, -999, 1.2300000000000004], [-999, -999, -999, -999, 0.4599999999999973], [-999, -999, -999, -999, 0.18999999999999773], [-999, -999, -999, -999, -999], [-999, -999, -999, -999, 0.4400000000000013], [-999, -999, -999, -999, 0.41000000000000014], [-999, -999, -999, -999, -0.21999999999999886], [-999, -999, -999, -999, 0.7900000000000027], [-999, -999, -999, -999, -999]] imputer.fit( aa) result = imputer.transform( aa ) print(result) with a result of
[[ 1.23 ] [ 0.46 ] [ 0.19 ] [ 0.47142857] [ 0.44 ] [ 0.41 ] [-0.22 ] [ 0.79 ] [ 0.47142857]]