[MRG] some clean-up in Imputer, particularly in calculation of sparse median

This:
* tests some edge cases in calculating a sparse median in `Imputer`
* reimplements that functionality for simpler computation
* leaves behaviour with NaNs in the array undefined, since `np.ma.median` is buggy (see #2918)
* silences some numpy warnings.