title: How to use Sum on groupBy result in Spark DatFrames?
body: <p>Based on the following dataframe:</p>
  <pre><code>+---+-----+----+
  | ID|Categ|Amnt|
  +---+-----+----+
  |  1|    A|  10|
  |  1|    A|   5|
  |  2|    A|  56|
  |  2|    B|  13|
  +---+-----+----+
  </code></pre>
  <p>I would like to obtain the sum of the column Amnt groupby ID and Categ.</p>
  <pre><code>+---+-----+-----+
  | ID|Categ|Count|
  +---+-----+-----+
  |  1|    A|  15 |
  |  2|    A|  56 |
  |  2|    B|  13 |
  +---+-----+-----+
  </code></pre>
  <p>In SQL I would be doing something like</p>
  <pre><code>SELECT ID,
         Categ, 
         SUM (Count) 
  FROM Table 
  GROUP BY ID,
           Categ;
  </code></pre>
  <p>But how to do this in Scala?
  I tried</p>
  <pre><code>DF.groupBy($&quot;ID&quot;, $&quot;Categ&quot;).sum(&quot;Count&quot;)
  </code></pre>
  <p>But this just changed the Count column name into <code>sum(count)</code> instead of actually giving me the sum of the counts.</p>