Giving this code:
import numpy as np
array1 = []
for i in range(10):
array1 = np.vstack((array1,i))
Is there a way to do this without having to treat the first case specifically? In my real code i have to iterate over 100000 times, so It feels to me that including something like this:
import numpy as np
array1 = []
for i in range(10):
if np.size(array1)==0:
array1 = np.append(array1,i)
else:
array1 = np.vstack((array1,i))
would bé a very ineficient way to solve it.
Is there anyway of making this step more eficient?
Edit: The code is just a simplifyed version of the code, here im just vtacking simple numbers. In the real code I stack arrays of 2 values so final array gives something like:
out_array = [[0.5,0.1],[0.2,0.1],...]