I have two arrays :
array_x = [x1, x2, x3, x4... xn]
array_y = [y1, y2, y3, y4... yn]
I would like to have a function f(array_x, array_y, value_x) that returns the value_y associated to the value_x by interpolation into the arrays. 
How to do that ?
I think that numpy.interp is exactly what you want.  e.g.:
numpy.interp(value_x,array_x,array_y)
Note that here value_x can be a scalar or another array-like value.  If it is an array-like value, you will be returned an array of corresponding interpolated values.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With