Pandas und scikit-learn: KeyError: [...] nicht im index

Verstehe ich nicht, warum erhalte ich die Fehlermeldung KeyError: '[ 1351 1352 1353 ... 13500 13501 13502] not in index' wenn ich diesen code ausführen:

cv = KFold(n_splits=10)

for train_index, test_index in cv.split(X):
    f_train_X, f_valid_X = X[train_index], X[test_index]
    f_train_y, f_valid_y = y[train_index], y[test_index]

Benutze ich X (ein Pandas dataframe) aufteilen, ich cv.split(X).

X.shape
y.shape
Out: (13503, 17)
Out: (13503,)
InformationsquelleAutor ScalaBoy | 2018-06-28
Schreibe einen Kommentar