FutureWarning: Arrays of bytes/strings is being converted to decimal numbers if dtype='numeric'

Viewed 6471
FutureWarning: Arrays of bytes/strings is being converted to decimal numbers if 
dtype='numeric'. This behavior is deprecated in 0.24 and will be removed in 1.1 (renaming of 0.26). 
Please convert your data to numeric values explicitly instead.

Please what does this mean? I have been trying to deploy my model but this keeps coming up when I run it

1 Answers

I believe that either your targets or features are not in numeric format.

For example:

['1.0', '2.0', '3.0', '4.0'] #  non-numeric format
[1.0, 2.0, 3.0, 4.0] #  numeric format

You can fix this by using numpy or a for loop as:

a = ['1.0', '2.0', '3.0', '4.0'] #  non-numeric format
b = np.array(a, dtype=float) #  convert using numpy
c = [float(i) for i in a] #  convert with for loop

As I understood, sklearn will convert non-numeric arrays to numeric so it works anyways, but judging by the warning that will not be longer the case going forward.

Next time please include your code or part of it so it is easier to help you. Cheers.

Related