ValueError: could not convert string to float: ' >50K'

I get the error “ValueError: could not convert string to float: ’ >50K’” when I try to cross validate either the DummyRegressor or the model suggested on the excercise.

Why is ‘cross_validate’ trying to convert the targets to floats?

I saw the solution and i’m doing basically the same…

Any idea?

Just figure it out.

I was setting the score as “neg_mean_absolute_error”. That is why the cross validation proccess tried to change the target to float.

Be aware that you are using a regressor instead of a classifier and therefore you should as well use classification metrics.

1 Like