I have an numpy array of shape (271,) with binary elements.
For example :
arr = array([0., 0., 0., 1., 1., 1., 0., 0., 1., .........])
How to convert this into a 3d array of shape 271*80*1 to form new_3d_arr ?
such that my new_3d_arr[0] is of shape 80 rows with 0's* 1 column
I hope there will be a simple approach to achieve this.
I tried below code & I can get the result what i required, but I hope there will be a simple approach to achieve this
new_3d_arr = []
for i in arr:
arr_2d = array([i]*80).reshape((-1,1))
new_3d_arr.append(arr_2d)
new_3d_arr = array(new_3d_arr)