title: Pandas: Merging rows into one
body: <p>I have the following table:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Name</th>
  <th>Age</th>
  <th>Data_1</th>
  <th>Data_2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Tom</td>
  <td>10</td>
  <td>Test</td>
  <td></td>
  </tr>
  <tr>
  <td>Tom</td>
  <td>10</td>
  <td></td>
  <td>Foo</td>
  </tr>
  <tr>
  <td>Anne</td>
  <td>20</td>
  <td></td>
  <td>Bar</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>How I can merge this rows to get this output:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Name</th>
  <th>Age</th>
  <th>Data_1</th>
  <th>Data_2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Tom</td>
  <td>10</td>
  <td>Test</td>
  <td>Foo</td>
  </tr>
  <tr>
  <td>Anne</td>
  <td>20</td>
  <td></td>
  <td>Bar</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I tried this code (and some other related (agg, groupby other fields, et cetera)):</p>
  <pre><code>import pandas as pd
  data = [['tom', 10, 'Test', ''], ['tom', 10, 1, 'Foo'], ['Anne', 20, '', 'Bar']]
  
  df = pd.DataFrame(data, columns=['Name', 'Age', 'Data_1', 'Data_2'])
  df = df.groupby(&quot;Name&quot;).sum()
  
  print(df)
  
  </code></pre>
  <p>But I only get something like this:</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th></th>
  <th>c2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>Name</td>
  <td></td>
  </tr>
  <tr>
  <td>--------</td>
  <td>--------------</td>
  </tr>
  <tr>
  <td>Anne</td>
  <td>Foo</td>
  </tr>
  <tr>
  <td>Tom</td>
  <td>Bar</td>
  </tr>
  </tbody>
  </table>
  </div>