I want to create 2D array with data from loop. Each loop iteration should add array within the array. As an example start from [ ] => [ [2,3] ] => [ [2,3] , [3,4] ] => [ [2,3] , [3,4] , [7,3] ] and likewise.
import numpy as np
output_arr = np.array([])
for i in range(0,4):
temp_arr = np.ones(2)
print temp_arr.shape
output = np.append((output_arr, temp_arr))
print output_arr.shape
Here np.append is sample code where I need to concatenate/append/hstack arrays together... (np.append didn't work.)
How to populate 2D array within the loop?
np.append. Learn to usenp.concatenateinstead. Look at thenp.appendcode to understand why I say that.