title: Add values from one dictionary to another after making operations on those values
body: <p>I have a pandas dataframe. I want to group the dataframe by 2 columns, get the length of the dataframe slices and then add the length to another dictionary, using the first part of the key, meaning "C".</p>
  
  <p>My code:</p>
  
  <pre><code>df = pd.DataFrame({'C': [20, 20, 20, 20, 10, 10, 10, 30, 30, 30],
                     'C2': [20, 20, 20, 20, 10, 10, 10, 30, 30, 30],
                     'D': [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]})
  
  df_dictionary = df.groupby(["C", "C2"])
  
  second_dict = dict()
  
  for key, df_values in df_dictionary:
      print(len(df_values.index))
  </code></pre>
  
  <p>I have tried the following:</p>
  
  <pre><code>for key[0], df_values in df_dictionary.iteritems():
      second_dict.setdefault(key, []).extend(df_values.index)
  </code></pre>
  
  <p>But it does not let me perform operations on the df_values. Is there some way I can go around this? In the end, the second dictionary should have the following values</p>