I have a (16000000,5) numpy array, and I want to apply this function on each row.
def f(row):
#returns a row of the same length.
return [row[0]+0.5*row[1],row[2]+0.5*row[3],row[3]-0.5*row[2],row[4]-0.5*row[3],row[4]+1]
vectorizing would operate slow.
I tried going like this
np.column_stack((arr[:,0]+0.5*arr[:,1],arr[:,2]+0.5*arr[:,3],arr[:,3]-0.5*arr[:,2],arr[:,4]-0.5*arr[:,3],arr[:,4]+1))
but I get Memory Error.
What is the fastest way to do this?