Failed to convert a NumPy array to a Tensor

Failed to convert a NumPy array to a Tensor,第1张

错误如下,说明模型不支持Object类型(非数值类型)的数据,所以需要讲Object类型的数据采用独热编码,或者自己进行预编码,代码如下:

import pandas as pd
data=pd.read_csv("test.csv")
for features in data.columns:
    if data[features].dtype == 'object':
        data[features] = pd.Categorical(data[features]).codes

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/langs/725389.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-04-26
下一篇2022-04-26

发表评论

登录后才能评论

评论列表(0条)

    保存