title: pandas.interpolate (method = 'linear') just copies values on first and last point
body: <p>I'm a bit new to <code>pandas.interpolate</code>.</p>
  
  <p>I have a pandas dataframe indexed by years from 2011 from 2017. I sometimes have missing values so I used interpolate with <code>method='linear'</code> and <code>limit_direction='both'</code> to fill the gaps.</p>
  
  <p>The screenshot below features the original dataframe (top) and the interpolation result (bottom).</p>
  
  <p>When a missing value is located between non-missing values, everything works fine: on the example below, a brand new value is generated in 2016.</p>
  
  <p>But when the NAs are at the beginning or at the end of the series, I am not satisfied by the result because it turns out that it is just a mere copy of the next non-missing values: on the example below, you can see that 2011 and 2012 were given the same value as 2013.</p>
  
  <p><a href="https://i.stack.imgur.com/vC8Lx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vC8Lx.png" alt="enter image description here"></a></p>
  
  <p>Then, I tried to use <code>method='polynomial'</code> with <code>order=2</code> to get a "smoother" interpolation, but I got the following error:</p>
  
  <pre><code>ValueError: number of derivatives at boundaries.
  </code></pre>
  
  <p>Can someone explain to me why I'm doing it wrong and which method I could use to get a nice interpolation, including for the first and the last value?</p>