Let\'s take data following :
import numpy as np x=np.linspace(0,2*np.pi,40) x = x.reshape(-1,1) y=np.sin(x)+np.random.normal(0,0.4,40)
I want