title: set limits to numpy polyfit
body: <p>I have two arrays with some data. In particular, the y array contains percentages that can not exceed y = 100 value.
  The y values satisfy the condition y &lt;100 but if I make a fit, the result is that the curve exceeds y = 100, as shown in the figure below.</p>
  
  <p>Is there any way to make a curve fit that does not exceed y = 100?</p>
  
  <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  import numpy.polynomial.polynomial as poly
  
  x = [0.25,0.75,1.25,1.75,2.15,2.75,3.15,3.75,4.15,4.75,5.15,5.75]
  y = [ 100.,100.,90.,69.23076923,47.36842105,39.13043478,   
       35.71428571,26.31578947,22.22222222,18.86792453,
       11.76470588,9.43396226]
  
  coefs = poly.polyfit(x, y, 3)
  ffit = poly.polyval(x, coefs)
  plt.plot(x, ffit)
  plt.show()
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4zljK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4zljK.png" alt="enter image description here"></a></p>