【发布时间】:2020-05-03 23:10:25
【问题描述】:
我正在编写 Python 代码来预测纽约市的出租车需求。我的数据如下图enter image description here
在我使用 SVR 预测出租车需求之后。我有以下错误:无法将字符串转换为浮点数:'19:40:00'
我的代码:
x_names = ['pickup_cluster','pickup_datetime','dayofyear','average temperature', 'precipitation','snow fall']
x = taxi_data[x_names]
y= taxi_data['Count']
xtrain, xtest, ytrain, ytest=sklearn.model_selection.train_test_split(x, y, test_size=0.1)
regressor = SVR(kernel='rbf', gamma='auto', C=0.1, epsilon=2)
regressor.fit(xtrain, ytrain)
acc = regressor.score(xtest, ytest)
print("Accuracy for SVR: ", acc)
【问题讨论】:
-
我的数据如下所示 不,请提供minimal reproducible example,除非绝对必要,否则请不要以图片形式分享信息。请参阅:meta.stackoverflow.com/questions/303812/…、idownvotedbecau.se/imageofcode、idownvotedbecau.se/imageofanexception。您从该错误消息中了解到什么?
标签: python