gpt4 book ai didi

python - future 警告 : Arrays of bytes/strings is being converted to decimal numbers if dtype ='numeric'

转载 作者:行者123 更新时间:2023-12-04 07:37:33 27 4
gpt4 key购买 nike

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.
请问这是什么意思?我一直在尝试部署我的模型,但是当我运行它时,它不断出现

最佳答案

我相信要么你的targetsfeatures不是数字格式。
例如:

['1.0', '2.0', '3.0', '4.0'] #  non-numeric format
[1.0, 2.0, 3.0, 4.0] # numeric format
您可以使用 numpy 解决此问题或 for 循环为:
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
据我了解, sklearn会将非数字数组转换为数字,因此无论如何它都可以工作,但从警告来看,这种情况不会再继续下去了。
下次请包括您的代码或其中的一部分,以便更容易为您提供帮助。
干杯。

关于python - future 警告 : Arrays of bytes/strings is being converted to decimal numbers if dtype ='numeric' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67664706/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com