I have a numpy array with the shape of (8750, 4, 35) which I'm trying to squeeze to (35000, 35). I tried with np.squeeze
:
a = np.array(pred_f)
np.squeeze(a).shape
but this still produces (8750, 4, 35) and changing the axis parameter causes an error:
ValueError: cannot select an axis to squeeze out which has size not equal to one
Does anyone have any clue on how can I do this?
CodePudding user response:
import numpy as np
a = np.random.random((8750, 4, 35))
a = np.reshape(a,(-1,35))
print(a.shape) #(35000,35)
Like Dr.Snoopy mentioned, reshape
is what you are looking for. It would look something like this.