预测明年的月度销售额

时间:2017-12-14 19:42:25

标签: python scikit-learn decision-tree prediction

我想预测明年每个月的销售情况,我有这个数据框:

enter image description here

我正在尝试

from sklearn.tree import DecisionTreeRegressor

X = df.iloc[:,:-1]
y = df.iloc[:,-1]

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

estimator = DecisionTreeRegressor()
estimator.fit(X_train,y_train)
estimator.predict(df)

但是我收到了这个错误:

  

模型的功能数量必须与输入匹配。模型n_features   是1并且输入n_features是2

0 个答案:

没有答案