title: sql: calculate number of hours per month
body: <p>i want to calculate the hours between dat_end and dat_beg group by id and month.</p>
  <pre><code>import pandas as pd
  df = pd.DataFrame({'id':['x1', 'x1', 'x1', 'x2', 'x2', 'x2', 'x2']
             ,  'date_beg':['2021-01-01 00:00:00',
             '2021-02-03 00:00:00','2021-02-04 00:00:00','2021-02-05 00:00:00',
             '2021-02-06 00:00:00','2021-03-05 00:00:00','2021-04-08 00:00:00'],
                'date_end':['2021-01-02 00:00:00 ',
             '2021-02-03 12:00:00','2021-02-04 10:00:00','2021-02-05 10:00:00',
             '2021-02-06 10:00:00','2021-03-07 10:00:00','2021-05-08 00:00:00']}
  </code></pre>
  <p>expected output:</p>
  <pre><code>x1 01/2021  48
  x1 02/2021  22
  x2 02/2021    20
  x2 03/2021     58
  x2 04/2021 720
  x2 05/2021 744
  </code></pre>