I'm having a problem with reshaping a DataFrame, after doing this

train_dane_rnn = np.reshape(train_dane, (train_dane.shape[0], train_dane.shape[1], 1))
test_dane_rnn = np.reshape(test_dane, (test_dane.shape[0], test_dane.shape[1], 1))

I'm getting this error

ValueError: Must pass 2-d input. shape=(15129, 10, 1)

1 Answer 1


You have to convert your DataFrame to a numpy array first.

Try this:

train_dane_rnn = np.reshape(np.array(train_dane), (train_dane.shape[0], train_dane.shape[1], 1))
test_dane_rnn = np.reshape(np.array(test_dane), (test_dane.shape[0], test_dane.shape[1], 1))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.