请帮助我解决这个错误,虽然可能是一个重复的问题,但我无法将其应用到我的代码中。
错误
---------------------------------------------------------------------------TypeError Traceback (most recent call last)<ipython-input-56-8c160cb8bf67> in <module>----> 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
数据集
9.999999,0.1,194.9999,0.1,189.9999,0.2,099.9999,0.3,0
回答:
我认为您可能需要以稍微不同的方式选择X
列,例如:
X = df[['COL1', 'COL2']]