title: Pandas fill in missing date within each group with information in the previous row
body: <p>Similar question to <a href="https://stackoverflow.com/questions/44978196/pandas-filling-missing-dates-and-values-within-group">this one</a>, but with some modifications:</p>
  
  <p>Instead of filling in missing dates for each group between the min and max date of the entire column, we only should be filling in the dates between the min and the max of <em>that group</em>, and output a dataframe with the last row in each group</p>
  
  <p>Reproducible example:</p>
  
  <pre><code>x = pd.DataFrame({'dt': ['2016-01-01','2016-01-03', '2016-01-04','2016-01-01','2016-01-01','2016-01-04']
                      ,'amount': [10.0,30.0,40.0,78.0,80.0,82.0]
                      , 'sub_id': [1,1,1,2,2,2]
                      })
  </code></pre>
  
  <p>Visually:</p>
  
  <pre><code>            dt   sub_id   amount
  0   2016-01-01        1     10.0
  1   2016-01-03        1     30.0
  2   2016-01-04        1     40.0
  3   2017-01-01        2     78.0
  4   2017-01-01        2     80.0
  5   2017-01-04        2     82.0
  </code></pre>
  
  <p>Output I need:</p>
  
  <pre><code>            dt   sub_id   amount
  0   2016-01-01        1     10.0
  1   2016-01-02        1     10.0
  2   2016-01-03        1     30.0
  3   2016-01-04        1     40.0
  4   2017-01-01        2     80.0
  5   2017-01-02        2     80.0
  6   2017-01-03        2     80.0
  7   2017-01-04        2     82.0
  </code></pre>
  
  <p>We are grouping by dt and sub_id. As you can see, in sub_id=1, a row was added for 2016-01-02 and amount was imputed at 10.0 as the previous row was 10.0 (Assume data is sorted beforehand to enable this). For sub_id=2 row was added for 2017-01-02 and 2017-01-03 and amount is 80.0 as that was the last row before this date. The first row for 2017-01-01 was also deleted because we just want to keep the last row for each date and sub_id.</p>
  
  <p>Looking for the most efficient way to do this as the real data has millions of rows. I have a current method using lambda functions and applying them across groups of sub_id but I feel like we could do better.</p>
  
  <p>Thanks!</p>