title: Ajusting date column (Fill the Date Gaps and update until specific date)
body: <p>I have the following situation:</p>
  
  <p>A dataframe that shows every inventory movements (Buy/Sell) of each products and store.</p>
  
  <pre><code>        date     sku     store  Units   balance
  0 2019-10-01  103993.0    001    0.0     10.0
  1 2019-10-02  103993.0    001    1.0      9.0
  2 2019-10-04  103993.0    001    1.0      8.0
  3 2019-10-05  103993.0    001    0.0      8.0
  4 2019-10-01  103994.0    002    0.0     12.0
  5 2019-10-02  103994.0    002    1.0     11.0
  6 2019-10-04  103994.0    002    1.0     10.0
  7 2019-10-05  103994.0    002    0.0     10.0
  </code></pre>
  
  <p>Supposing today is 2019-10-08, what is the best way to update this date:</p>
  
  <ul>
  <li>Filling the gaps (eg. adding 2019-01-03 row)</li>
  <li>Update every (sku and Store) to today's date:
  
  <ul>
  <li>Keeping Store and Balance column with the last value</li>
  <li>Insert 0 to Units columns (which means during these days, I didn't have units sold)</li>
  </ul></li>
  </ul>
  
  <p>So the output should be like this:</p>
  
  <pre><code>           date     sku     store  Units   balance
      0 2019-10-01  103993.0    001    0.0     10.0
      1 2019-10-02  103993.0    001    1.0      9.0
      2 2019-10-03  103993.0    001    0.0      9.0
      3 2019-10-04  103993.0    001    1.0      8.0
      4 2019-10-05  103993.0    001    0.0      8.0
      5 2019-10-06  103993.0    001    0.0      8.0
      6 2019-10-07  103993.0    001    0.0      8.0
      7 2019-10-08  103993.0    001    0.0      8.0
      8 2019-10-01  103994.0    002    0.0     12.0
      9 2019-10-02  103994.0    002    1.0     11.0
     10 2019-10-03  103994.0    002    0.0     11.0
     11 2019-10-04  103994.0    002    1.0     10.0
     12 2019-10-05  103994.0    002    0.0     10.0
     13 2019-10-06  103994.0    002    0.0     10.0
     14 2019-10-07  103994.0    002    0.0     10.0
     15 2019-10-08  103994.0    002    0.0     10.0
  </code></pre>
  
  <p>The only way I found to do this is:</p>
  
  <pre><code>    dfs = []
      for _, d in df.groupby(['sku', 'store']):
  
          start_date = d.date.iloc[0]
          end_date = pd.Timestamp('2019-10-08')
  
          d.set_index('date', inplace=True)
          d = d.reindex(pd.date_range(start_date, end_date))
          dfs.append(d)
  
      df = pd.concat(dfs)
      df[['units']] = df[['units']].fillna(0)
      df.ffill(inplace=True)
  </code></pre>
  
  <p>However this code is not well vectorized. Is there a better way to get the same result ?</p>