title: Subtract and add values from rows in dataframe
body: <p>I have a dataframe where my data looks like the following atm.</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>date</th>
  <th>value</th>
  <th>name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2022-01-19</td>
  <td>98</td>
  <td>audiobook_processed</td>
  </tr>
  <tr>
  <td>2022-01-19</td>
  <td>69</td>
  <td>n_known_errors</td>
  </tr>
  <tr>
  <td>2022-01-19</td>
  <td>2</td>
  <td>n_unknown_errors</td>
  </tr>
  <tr>
  <td>2022-01-21</td>
  <td>14</td>
  <td>audiobook_processed</td>
  </tr>
  <tr>
  <td>2022-01-21</td>
  <td>1</td>
  <td>n_known_errors</td>
  </tr>
  <tr>
  <td>2022-01-21</td>
  <td>0</td>
  <td>n_unknown_errors</td>
  </tr>
  <tr>
  <td>2022-01-24</td>
  <td>56</td>
  <td>audiobook_processed</td>
  </tr>
  <tr>
  <td>2022-01-24</td>
  <td>1</td>
  <td>n_known_errors</td>
  </tr>
  <tr>
  <td>2022-01-24</td>
  <td>2</td>
  <td>n_unknown_errors</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>But I need to get the &quot;total&quot; amount of <code>audiobook_processed</code> by subtracting <code>n_know_errors</code> and <code>n_unknown_errors</code> so the data would be</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>date</th>
  <th>value</th>
  <th>name</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>2022-01-19</td>
  <td>27</td>
  <td>audiobook_processed</td>
  </tr>
  <tr>
  <td>2022-01-19</td>
  <td>69</td>
  <td>n_known_errors</td>
  </tr>
  <tr>
  <td>2022-01-19</td>
  <td>2</td>
  <td>n_unknown_errors</td>
  </tr>
  <tr>
  <td>2022-01-21</td>
  <td>13</td>
  <td>audiobook_processed</td>
  </tr>
  <tr>
  <td>2022-01-21</td>
  <td>1</td>
  <td>n_known_errors</td>
  </tr>
  <tr>
  <td>2022-01-21</td>
  <td>0</td>
  <td>n_unknown_errors</td>
  </tr>
  <tr>
  <td>2022-01-24</td>
  <td>53</td>
  <td>audiobook_processed</td>
  </tr>
  <tr>
  <td>2022-01-24</td>
  <td>1</td>
  <td>n_known_errors</td>
  </tr>
  <tr>
  <td>2022-01-24</td>
  <td>2</td>
  <td>n_unknown_errors</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>My code:</p>
  <pre><code>from xxx.input import get_automation_xxx
  
  def graph_visual_data(script_title):
      data = get_automation_xxx(script_title)
      data = data[data.name.isin(['audiobook_processed', 'n_unknown_errors', 'n_known_errors'])][['date','value','name']]
      data.date = data.date.dt.date
      data.value = data.value.astype(int)
  
      data = data.groupby(['date','name'], as_index=False).sum()
      data['sub_total'] = (data.name['audiobook_processed'] - (data.name['n_unknown_errors'] + data.name['n_known_errors'])) &lt;-- This fails...
  
      fig = alt.Chart(data).mark_bar(size=10).encode(
          x='date',
          y='value',
          color='name',
          tooltip=['name', 'value']
      ).interactive()
      st.altair_chart(fig, use_container_width=True)
  </code></pre>
  <p>I've tried to create a new table row with the combined result but with no luck...
  Anyone have a smart way of solving this?</p>
  <p>Thanks in advance</p>