'Train and test split not seperate

I have a dataframe of shape (2714,3) and I'm creating a data structure with 24 timestamps and 1 output, where: train = 2761 * 0.8.

After splitting the train and test using the below method:

X_train, y_train = X_train[:train], y_train[:train]
X_test, y_test = X_train[train:], y_train[train:]

X_train.shape, y_train.shape, X_test.shape, y_test.shape

I get this output: (2171, 24, 3), (2171, 1), (0, 24, 3), (0, 1)

Why is X_test and y_test receiving 0 here?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source