I have a 12 feature data frames named as X[0]
, X[1]
... till X[11]
and corresponding to it 12 response data frames as y[0]
to y[11]
. I need to split them into train and test data frames using the train_test_split function. As this processes empty lists (X_train[], X_test[], y_train[] and y_test[])
simple assignment:
b = 0
while b < 12:
X_train[b], X_test[b], y_train[b], y_test[b] = train_test_split(X[b], y[b], random_state=0)
b = b + 1
gives this error:
IndexError: list assignment index out of range
I don't know how to use append()
function here.
Can anyone please help me out?