title: Fill in rows in Pandas by date, conditional on row not existing
body: <p>How can you 'copy' previous rows from a Pandas dataframe where it is indexed by a date, if the row does not exist on the next date. This is motivated by the problem below.</p>
  
  <p><strong>Problem</strong></p>
  
  <p>My example <code>data</code> is</p>
  
  <pre><code>DATE | TEAM | PLAYER
  -----+------+-------
   0   |  A   |  John
   0   |  A   |  Tom
   0   |  B   |  Chris
   0   |  B   |  Rob
   1   |  A   |  John
   1   |  A   |  George
   1   |  B   |  Chris
   2   |  A   |  Rob
  </code></pre>
  
  <p>I am trying to build on object <code>X</code> so that I can do something like</p>
  
  <pre><code>X.loc[date, team]
  </code></pre>
  
  <p>and it will return all <code>players</code> whose last observation was for <code>team</code> on <code>date</code>.</p>
  
  <p>Now to be clear, I would want</p>
  
  <pre><code>X.loc[0, 'A'] = ['John', 'Tom']
  X.loc[0, 'B'] = ['Chris', 'Rob']
  
  X.loc[1, 'A'] = ['John', 'Tom', 'George']
  X.loc[1, 'B'] = ['Chris', 'Rob']
  
  X.loc[2, 'A'] = ['John', 'Tom', 'George', 'Rob']
  X.loc[2, 'B'] = ['Chris']
  </code></pre>
  
  <p><strong>Idea</strong></p>
  
  <p>My idea was that I could 'fill in' values from previous dates for players who were not observed on that date e.g. <code>data_filled</code></p>
  
  <pre><code>DATE | TEAM | PLAYER | FILLED
  -----+------+--------+-------
   0   |  A   |  John  |   0
   0   |  A   |  Tom   |   0
   0   |  B   |  Chris |   0
   0   |  B   |  Rob   |   0
   1   |  A   |  John  |   0
   1   |  A   |  George|   0
   1   |  B   |  Chris |   0
   1   |  A   |  Tom   |   1
   1   |  B   |  Rob   |   1
   2   |  A   |  Rob   |   0
   2   |  A   |  John  |   1
   2   |  A   |  George|   1
   2   |  B   |  Chris |   1
   2   |  A   |  Tom   |   1
  </code></pre>
  
  <p>where I added a <code>FILLED</code> column just to represent if the row was added to <code>data</code>. Now I believe I can get what I want by</p>
  
  <pre><code>X = data_filled.set_index(['DATE', 'TEAM'])
  </code></pre>
  
  <p>and I can the use</p>
  
  <pre><code>X.loc[data, team]
  </code></pre>
  
  <p>to get the list of players.</p>