决策树分类器拟合函数抛出错误“ ValueError:无法将字符串转换为浮点数:'E-50'”

时间:2018-09-09 18:27:59

标签: python jupyter decision-tree

我正在尝试使用决策树分类器拟合从xlsx文件获取的数据,但出现错误“ ValueError:无法将字符串转换为float:'E-50'”。

以下是我在Jupyter Notebook中的代码:

import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import tree
from sklearn.tree import DecisionTreeClassifier
results = pd.read_excel("new3.xlsx")
Y = np.array(results.values[:, 1:9])
X=  np.array(results.values[:,0])
X_Train,X_Test,Y_Train,Y_Test= train_test_split(X,Y, test_size = 0.3, 
random_state = 176)
model = DecisionTreeClassifier()
model.fit(X_Train,Y_Train)

0 个答案:

没有答案