I have a numpy array of shape arr.shape: (416809, )
which has:
arr[0].shape:
(300,)
and I whish to reshape to: (416809, 300)
I was searching at the documentation but I was unable to find a solution.
Any help would be grateful!
Thanx!
To convert the shape of a NumPy array ndarray, use the reshape() method of ndarray or the numpy.reshape() function.
Here is an example for your reference
import numpy as np
a = np.arange(24)
print(a)
# [ 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23]
print(a.shape)
# (24,)
a_4_6 = a.reshape([4, 6])
print(a_4_6)
# [[ 0 1 2 3 4 5]
# [ 6 7 8 9 10 11]
# [12 13 14 15 16 17]
# [18 19 20 21 22 23]]
np.stack(arr)work?(416809, 300)is the shape tuple, not the array produced bystack.