Open Bonesters opened 4 years ago
Thanks for the bug report @Bonesters!
It sounds like you know how to fix this issue. It'd be great to have a pull request for this!
If not, could you provide a minimal working example? Here's some tips: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports
The pull request has been created. My initial idea didn't work, but I came up with a solution that should match the behavior of sklearn's SimpleImputer in addition to giving a clearer error.
Currently, if a dataframe with non-numeric values is passed into the simple imputer and the strategy is mean or median, it will give an error like
ValueError: Length of passed values is 2, index implies 3
. This is because the mean and quantile functions automatically exclude any non-numeric columns. Ifnumeric_only=False
gets passed to the mean and quantile functions, it would give a more straightforward error likeTypeError: could not convert string to float: 'xyz'
for mean, andTypeError: can't multiply sequence by non-int of type 'float'
for median.