title: Pandas interpolate within a groupby
body: <p>I've got a dataframe with the following information:</p>
  
  <pre><code>    filename    val1    val2
  t                   
  1   file1.csv   5       10
  2   file1.csv   NaN     NaN
  3   file1.csv   15      20
  6   file2.csv   NaN     NaN
  7   file2.csv   10      20
  8   file2.csv   12      15
  </code></pre>
  
  <p>I would like to interpolate the values in the dataframe based on the indices, <strong>but only within each file group</strong>.</p>
  
  <p>To interpolate, I would normally do</p>
  
  <pre><code>df = df.interpolate(method="index")
  </code></pre>
  
  <p>And to group, I do</p>
  
  <pre><code>grouped = df.groupby("filename")
  </code></pre>
  
  <p>I would like the interpolated dataframe to look like this:</p>
  
  <pre><code>    filename    val1    val2
  t                   
  1   file1.csv   5       10
  2   file1.csv   10      15
  3   file1.csv   15      20
  6   file2.csv   NaN     NaN
  7   file2.csv   10      20
  8   file2.csv   12      15
  </code></pre>
  
  <p>Where the NaN's are still present at t = 6 since they are the first items in the file2 group.</p>
  
  <p>I suspect I need to use "apply", but haven't been able to figure out exactly how...</p>
  
  <pre><code>grouped.apply(interp1d)
  ...
  TypeError: __init__() takes at least 3 arguments (2 given)
  </code></pre>
  
  <p>Any help would be appreciated.</p>