Create function (fit model) with datasets x,y using polynomial function
import numpy as np
x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0])
y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0])
z = np.polyfit(x, y, 3)
print(z)
# array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) # coeff of function
# It is convenient to use poly1d objects for dealing with polynomials:
fp = np.poly1d(z)
# Use the function
print(fp(0.5))
#0.6143849206349179
print(fp(3.5))
#-0.34732142857143039
print(fp(10))
#22.579365079365115