sklearn TimeSeriesSplit Error: KeyError: '[ 0 1 2 …] not in index'
问题 I want to use TimeSeriesSplit from sklearn on the following dataframe to predict sum: So to prepare X and y I do the following: X = df.drop(['sum'],axis=1) y = df['sum'] and then feed these two to: for train_index, test_index in tscv.split(X): X_train01, X_test01 = X[train_index], X[test_index] y_train01, y_test01 = y[train_index], y[test_index] by doing so, I get the following error: KeyError: '[ 0 1 2 ...] not in index' Here X is a dataframe, and apparently this cause the error, because if