title: Pandas value_counts() + weight
body: <p>I have a Pandas dataframe like this:</p>
  
  <pre><code>df = pd.DataFrame({'id': [121, 34324, 111, 12, 45, 232],
                'weight': [10, 2, 80, 49, 71, 18],
                'var_bool': [True, True, False, True, False, True],
                'var_cat': ['red', 'blue', 'red', 'green', 'green', 'blue']})
  
  df['var_bool'] = df['var_bool'].astype('bool')
  df['var_cat'] = df['var_cat'].astype(pd.api.types.CategoricalDtype())
  </code></pre>
  
  <p>I'd like to apply a function to count the frequency of unique labels, with a weight given by the "weight" column:</p>
  
  <pre><code>df['var_bool'].value_counts() #I need to consider the weight of each row
  df['var_cat'].value_counts() #I need to consider the weight of each row
  </code></pre>
  
  <p>The function has to work both for "var_bool" and "var_cat", possibly with a fast engine (the dataframe is quite big). Thanks a lot!</p>
  
  <p>edit: the result should be:</p>
  
  <pre><code>#for "var_bool"
  True 79
  False 151
  
  #for "var_cat"
  red 90
  blue 20
  green 120
  </code></pre>