【发布时间】:2020-12-15 12:27:57
【问题描述】:
我正在尝试手动创建 Orange 表,但遇到了一些问题。
我的代码:
new_domain = Domain([
ContinuousVariable("NAME"),
ContinuousVariable("AGE"),
DiscreteVariable("BLOOD TYPE", list(["A+", "A-", "B+", "B-", "AB+", "AB-", "O+", "O-"]))
])
data = np.array([
["Joe", "25", "B-"],
["Marc", "30", "AB+"],
["Martin", "28", "O-"]
], dtype=object)
orangeTable = Table.from_numpy(new_domain, X=data)
但是,我收到此错误:
ValueError: could not convert string to float: 'Joe'
我不明白为什么它会尝试这种转换,有什么问题吗? 我才刚刚开始,所以目前还不是一切都清楚......
【问题讨论】:
标签: numpy-ndarray orange