'Fitting a curve to estimate x and y coordinate of any point

I am trying to estimate the x given y == 0.9 for a curve I plotted with a set of points xs and ys. But as we could see in the snapshot, the fitted curve does not give an accurate estimate of x.

What I currently do is using scipy.interpolate.interp1d like below

f = interp1d(xs, ys, kind="cubic")
x = f(0.9)

I am wondering if there is better alternative to interp1d that gives my a better estimate?

enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source