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

1

5
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

Tautomerism answered 23/5, 2021 at 21:52 Comment(0)
A
6

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.

Antifriction answered 1/7, 2021 at 10:21 Comment(2)
Thank you. This clarified the problem for meTautomerism
This worked out for me. I converted the series to a list and passed it np.array specifying dtype=float. That solved the issue.Waterside

© 2022 - 2024 — McMap. All rights reserved.