pythonnumpy������,pythonnumpy:int数组可以转换为标量索引

关注

Please help me to get out of this error, maybe, it's duplicate but I could not set it for my code.

import pandas as pdfrom sklearn.model_selection import KFolddf = pd.read_csv('DATA.txt',delimiter=',')df.head() X= df.COL1,df.COL2Y=df.COL3print(X)print(Y)cv = KFold(n_splits=2, random_state=10, shuffle=False)for train_index, test_index in cv.split(X):print("Train Index: ", train_index, "\n")print("Test Index: ", test_index)X_train, X_test, Y_train, Y_test = X[train_index], X[test_index], Y[train_index], Y[test_index]print(X_train)print(Y_train)

ERROR

---------------------------------------------------------------------------TypeError Traceback (most recent call last) in ----> 1 X_train, X_test, Y_train, Y_test = X[train_index], X[test_index], Y[train_index], Y[test_index]TypeError: only integer scalar arrays can be converted to a scalar index

dataset

9.999999,0.1,194.9999,0.1,189.9999,0.2,099.9999,0.3,0