title: Generating 2nd degree polynomial out of some data
body: <p>I have some data which I want to generate a 2nd degree polyfit like this as example:
  <a href="https://i.stack.imgur.com/EbH9u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EbH9u.png" alt="Polynomial i want to make" /></a></p>
  <p>I have tried two different codes but the polynomial just trying to go through all points.</p>
  <pre><code>import pandas as pd
  import matplotlib.pyplot as plt
  import numpy as np
  
  data = pd.read_csv('TESTEXskelet.csv', sep=&quot;,&quot;)
  
  x = data.Gennemsnitlig_hastighed
  y1 = data.Sum_VSP
  
  np.polyfit(x,y1,2)
  
  plt.grid()
  plt.title(&quot;VSP sum/hastighed&quot;)
  plt.ylabel('VSP - kW/ton')
  plt.xlabel('Hastighed - km/t')
  
  plt.scatter(x,y1,s=5) # Definere selve plottet
  plt.plot(x, y1)
  </code></pre>
  <p>But then it plots it through every point.
  <a href="https://i.stack.imgur.com/sRiHS.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sRiHS.png" alt="Python plot" /></a></p>
  <p>I have also tried with sklearn, and I can upload that if requested.</p>