title: Pandas calculating percentage of employed individuals grouped by month and year
body: <p>I have a file that contains 3 columns, year: 'HRYEAR4', month: 'HRMONTH', and employment status at the time: 'PEMPLR_1'. The employment status is a dummy taking value 1 if employed and 0 otherwise.</p>
  <p>I want to calculate the percentage of individuals who are employed within a given month, at the year.</p>
  <p>I have data from jan. 2018 - apr. 2020 in the data frame df_CPS:</p>
  <pre><code>             HRMONTH    HRYEAR4    PEMLR_1
  0            1          2018       1        
  1            1          2018       1  
  2            1          2018       1
  3            1          2018       0
  4            1          2018       0
  ...         ...          ...      ...
  1498116      4          2020       1
  1498117      4          2020       1
  1498118      4          2020       0
  1498119      4          2020       1
  1498120      4          2020       1
  </code></pre>
  <p>I can get the amount of individuals who are employed grouped by year and month and the total number of individuals in the dataset grouped by year and month:</p>
  <pre><code># Individuals who have answered PEMLR = 1 (employed) in a given month, year
  df_CPS.groupby(['HRYEAR4', 'HRMONTH']).agg({'PEMLR_1': 'sum'})
  
  # Individuals in total in a given month, year
  df_CPS.groupby(['HRYEAR4', 'HRMONTH']).size()
  </code></pre>
  <p>But, how can i calculate the percentage of individuals who are employed grouped by month and year?
  and add it to the original data set?</p>
  <p>I would like to end up with:</p>
  <pre><code>             HRMONTH    HRYEAR4    PEMLR_1    PEMLR_PCT
  0            1          2018       1          90.1       
  1            1          2018       1          90.1  
  2            1          2018       1          90.1
  3            1          2018       0          90.1
  4            1          2018       0          90.1
  ...         ...          ...      ...        ...
  1498116      4          2020       1          73.8
  1498117      4          2020       1          73.8
  1498118      4          2020       0          73.8
  1498119      4          2020       1          73.8
  1498120      4          2020       1          73.8
  </code></pre>