title: How to create a trendline with gaps of missing data in python?
body: <p>So I'm new to python AND data analysis, but have been tasked to create a scatter plot.  The data set that I'm using has many elements containing None values.  When I use the polyfit method to create a trendline(best-fit line) I get errors for the Nones.  I've tried using lists and numpy arrays with dismal results.  I've also tried masked_array, masked_invalid, ect. in MULTIPLE configurations, but it kept giving me an array filled with Nones.  Is there a way of creating a trendline in such a way that I don't need to remove the elements that have None values?  I need them to keep my plot dimensions correct. I'm using Python 2.7.  This is what I got so far:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import numpy as np
  import numpy.ma as ma
  import pylab
  #The InterpolatedUnivariateSpline method popped up during my endeavor 
  #to extrapolate the trendline through the gaps in data.
  #To be honest, I don't think its doing anything for me...
  from scipy.interpolate import InterpolatedUnivariateSpline  
  
  fig, ax = plt.subplots(1,1)
  ax.scatter(y, dbm, color = 'purple', marker = 'o', s = 100)
  plt.xlim(min(y), max(y)) 
  plt.xlabel('Temp - C')
  dbm_array = np.asarray(dbm) #dbm and y are lists earlier in the program
  y_array = np.asarray(y)
  
  x = np.linspace(min(y), max(y), len(y))
  order = 1
  s = InterpolatedUnivariateSpline(y, dbm, k=order)
  blah = s(x)
  plt.plot(y, blah, '--k')  
  </code></pre>
  
  <p>This gives me the scatter plot without the trendline for some reason.  No errors, so I guess I got that going for me....
  Thank you so much in advance!</p>