title: How to interpolate missing values with groupby?
body: <p>I cannot get missing values to interpolate correctly when I use the groupby function.</p>
  
  <p>Here is a quick example of what I have tried: </p>
  
  <pre><code>import pandas as pd
  import numpy as np
  
  # Create data
  state = pd.Series(['A', 'A', 'A', 'A', 'B', 'B', 'B', 'B'])
  population = pd.Series([100, 150, np.nan, np.nan, 50, 125, np.nan, np.nan])
  year = [2016, 2017, 2018, 2019, 2016, 2017, 2018, 2019]
  dict = {'state': state, 'population': population, 'year': year}  
  df = pd.DataFrame(dict) 
  
  # Interpolate population, grouped by states
  df.groupby('state').apply(lambda x: x.interpolate(method='linear')) 
  
    state  population  year
  0     A       100.0  2016
  1     A       150.0  2017
  2     A       150.0  2018
  3     A       150.0  2019
  4     B        50.0  2016
  5     B       125.0  2017
  6     B       125.0  2018
  7     B       125.0  2019
  </code></pre>
  
  <p>As you notice, when grouping by <code>state</code>, it is simply repeating the last value.</p>