-1

X=latest_df[['open', 'high', 'low', 'volume', 'market']]

y=latest_df['close']

y = np.where(df['close'].shift(-1) > df['close'], 1, -1)

X = pd.DataFrame(X)

y = pd.DataFrame(y)


a = X.shape

b = y.shape


import random

random.seed(1234)

from sklearn.model_selection import train_test_split

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=101)


**X.shape = (9,5)

y.shape = (11623,1)**

1 Answers1

0

You are running into that error because your X and Y don't have the same length (which is what train_test_split requires), i.e., X.shape[0] != Y.shape[0].

Visit this for reference.

Shag
  • 430
  • 2
  • 5