title: Aggregating row without summing rows that reference to the same period
body: <p>I'm facing a problem when calculating a candidates total years of experience using Pandas. I have two tables:</p>
  <ol>
  <li>The first one contains information about the candidates.</li>
  <li>The second one contains information about the candidates job experiences (Each candidate can have 0 or more than one job experiences, but the same job experience cannot be shared across different candidates).</li>
  </ol>
  <p>What I would like to do is to compute the length of each candidate job experience. In order to do so my first approach was to calculate the length of each job experience</p>
  <pre><code>job_experience_df.loc[:, 'job_experience_length'] = job_experience.loc[:, 'end_date'] - job_experience.loc[:, 'start_date']
  </code></pre>
  <p>and then convert the values to years and execute a group by by candidates_id.</p>
  <p>The problem with this approach is that many candidates have more than one job at the same time and I would like to not count overlapping job experiences. In other words I want the years of experience for each candidates ignoring how many jobs they are doing at the same time.</p>
  <p>I attach an example, with the job_experiences related to a single candidate (C-001):</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>job_experience_id</th>
  <th>start_date</th>
  <th>end_date</th>
  <th>candidate_id</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>J-001</td>
  <td>01-01-2015</td>
  <td>01-01-2018</td>
  <td>C-001</td>
  </tr>
  <tr>
  <td>J-002</td>
  <td>01-01-2017</td>
  <td>01-01-2019</td>
  <td>C-001</td>
  </tr>
  <tr>
  <td>J-003</td>
  <td>01-01-2020</td>
  <td>01-01-2022</td>
  <td>C-001</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>The result I would like to obtain is 6 years of experience (since the J-001 and J-002 job_experiences intersect each other, for one year, I would like to count the sum of them as 4 years and not 5).</p>
  <p>Is there already a way to do this kind of operation or I need to implement it from scratch?</p>