IAM尝试训练模型,但出现KeyError:0
def startModel(ht):
t1=ht['title']
l1=ht['location']
table_headers=['accepted']
le = preprocessing.LabelEncoder()
title_encoded=le.fit_transform(t1)
location_encoded=le.fit_transform(l1)
label=le.fit_transform(table_headers)
features=list(zip(title_encoded,location_encoded))
model = KNeighborsClassifier(n_neighbors=3)
model.fit(features,label)
predicted= model.predict([[title_encoded,location_encoded]])