当我适合决策树时收到错误

时间:2019-07-13 13:54:35

标签: python classification data-science

我想预测数据集中ac列的值

链接到数据集:https://data.world/ewood/home-energy-consumption

代码:

import pandas as p
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
import datetime
import  time

data=p.read_csv(r"C:\Users\harik\Contacts\Desktop\python\rawdata\datasets\house.csv)
data["ac-predict"]=data["AC"]
x=data.copy()
y=data["ac-predict"]
x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.33, random_state=324)
ac_predictor = DecisionTreeClassifier(max_leaf_nodes=10, random_state=0)
ac_predictor.fit(x_train,y_train)

执行代码后出现错误:

  

ValueError:无法将字符串转换为float:'2016-08-02   23:00:00-05:00'

0 个答案:

没有答案