-1

There are tons of samples from this error in which the problem is related with dimensions of the array or how a dataframe is read. However, I'm using just a python list for both X and Y.

I'm trying to split my code in train and test with train_test_split.

My code is this: enter image description here

And this teh error enter image description here

Please Help me for the solution

How to solve this error code for spliting my code in train and test with train_test_split?

1 Answers1

2

You are running into that error because your X and Y don't have the same length (which is what train_test_split requires)

X.shape[0] != Y.shape[0]
951 != 2025

Solution: Try to convert X and Y to the same length.

Julia Meshcheryakova
  • 3,162
  • 3
  • 22
  • 42
ATmax
  • 21
  • 2
  • I try to convert X and Y to the same length, but it's not changed. Here is code # Concatenating all features to the 'X' variable. X = np.concatenate((f_mfccs), axis=1) # Preparing 'Y' as a 2D shaped variable. Y = np.asarray(emotions).astype('int8') Y = np.expand_dims(Y, axis=1) X.shape[0] != Y.shape[0] 951 != 2025 – Gorga Siagian Jan 07 '23 at 14:57