2-D array X may contain np.nan. Replace every NaN with the mean of its own column (computed ignoring NaNs), and return the result. Compute the column means first — don't let an already-replaced value affect a later column's mean.
X
np.nan
solve(...)