Suppose that I have a (400,10) array called x
and a (400,10) array called y
. Is that possible to do a polyfit of each row in y
to the corresponding row in x
without iteration? If with for
loop it will be something like
import numpy as np
coe = np.zeros((400,3))
for i in np.arange(y.shape[0]):
coe[i,:] = np.polyfit(x[i,:], y[i,:], 2)
Because the 400 rows in x
is totally different, I cannot just apply np.polyfit with the same x
coordinate to a multi-dimensional array y
.