我想预测明年每个月的销售情况,我有这个数据框:
我正在尝试
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