title: How to balance panel data by adding missing rows with no information?
body: <p>I have an unbalanced dataset, namely <code>unbalanced.df</code> that looks as follows:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Date</th>
  <th>ID</th>
  <th>City</th>
  <th>State</th>
  <th>Quantity</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2019-01</td>
  <td>10001</td>
  <td>Los Angeles</td>
  <td>CA</td>
  <td>500</td>
  </tr>
  <tr>
  <td>2019-02</td>
  <td>10001</td>
  <td>Los Angeles</td>
  <td>CA</td>
  <td>995</td>
  </tr>
  <tr>
  <td>2019-03</td>
  <td>10001</td>
  <td>Los Angeles</td>
  <td>CA</td>
  <td>943</td>
  </tr>
  <tr>
  <td>2019-01</td>
  <td>10002</td>
  <td>Houston</td>
  <td>TX</td>
  <td>4330</td>
  </tr>
  <tr>
  <td>2019-03</td>
  <td>10002</td>
  <td>Houston</td>
  <td>TX</td>
  <td>2340</td>
  </tr>
  <tr>
  <td>2019-01</td>
  <td>10003</td>
  <td>Sacramento</td>
  <td>CA</td>
  <td>235</td>
  </tr>
  <tr>
  <td>2019-02</td>
  <td>10003</td>
  <td>Sacramento</td>
  <td>CA</td>
  <td>239</td>
  </tr>
  <tr>
  <td>2019-03</td>
  <td>10003</td>
  <td>Sacramento</td>
  <td>CA</td>
  <td>233</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>As you can see, Houston does not have <code>2019-02</code> as a Date. This happens all throughout my panel data with different cities.</p>
  <p>I want to make this panel symmetric by adding NA rows on the missing dates, such that the new panel data looks like this, <code>balanced.df</code>:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Date</th>
  <th>ID</th>
  <th>City</th>
  <th>State</th>
  <th>Quantity</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2019-01</td>
  <td>10001</td>
  <td>Los Angeles</td>
  <td>CA</td>
  <td>500</td>
  </tr>
  <tr>
  <td>2019-02</td>
  <td>10001</td>
  <td>Los Angeles</td>
  <td>CA</td>
  <td>995</td>
  </tr>
  <tr>
  <td>2019-03</td>
  <td>10001</td>
  <td>Los Angeles</td>
  <td>CA</td>
  <td>943</td>
  </tr>
  <tr>
  <td>2019-01</td>
  <td>10002</td>
  <td>Houston</td>
  <td>TX</td>
  <td>4330</td>
  </tr>
  <tr>
  <td>2019-02</td>
  <td>10002</td>
  <td>Houston</td>
  <td>TX</td>
  <td>NaN</td>
  </tr>
  <tr>
  <td>2019-03</td>
  <td>10002</td>
  <td>Houston</td>
  <td>TX</td>
  <td>2340</td>
  </tr>
  <tr>
  <td>2019 -01</td>
  <td>10003</td>
  <td>Sacramento</td>
  <td>CA</td>
  <td>235</td>
  </tr>
  <tr>
  <td>2019-02</td>
  <td>10003</td>
  <td>Sacramento</td>
  <td>CA</td>
  <td>239</td>
  </tr>
  <tr>
  <td>2019-03</td>
  <td>10003</td>
  <td>Sacramento</td>
  <td>CA</td>
  <td>233</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>In this case, I have an absolute minimum date and absolute maximum date, so I want to make sure that all cities follow the same dates. How can I fill my panel with NaN rows for cities and have therefore the same number of rows for each ID, City and State?</p>