title: How to add groupBy().count() to the source DataFrame?
body: <p>I have the following dataframe:</p>
  
  <pre><code>+---------------+--------------+--------------+-----+
  |        column0|       column1|       column2|label|
  +---------------+--------------+--------------+-----+
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  |05:49:56.604900|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  |05:49:56.604900|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  |05:49:56.604900|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  |05:49:56.604900|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  |05:49:56.604900|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  |05:49:56.604900|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604899|10.0.0.2.54880| 10.0.0.3.5001|    2|
  |05:49:56.604908| 10.0.0.3.5001|10.0.0.2.54880|    2|
  +---------------+--------------+--------------+-----+
  </code></pre>
  
  <p>I want to apply groupBy and count on it and make the following result:</p>
  
  <pre><code>+--------------+--------------+-----+
  |       column1|       column2|count|
  +--------------+--------------+-----+
  |10.0.0.2.54880| 10.0.0.3.5001|   19|
  | 10.0.0.3.5001|10.0.0.2.54880|   10|
  +--------------+--------------+-----+
  </code></pre>
  
  <p>I know that I have to use this:</p>
  
  <pre><code>dataFrame_Train.groupBy("column1", "column2").count().show()
  </code></pre>
  
  <p>However the problem is that <strong>I need to add "count" column as a permanent column to my dataframe.</strong> 
  In the above case, if I use <code>dataFrame_Train.show()</code> after the <code>groupBy</code>, I see the first dataframe without "count" column. This code:</p>
  
  <pre><code>dataFrame_Train.groupBy("column1", "column2").count().show()
  `dataFrame_Train.show()`
  </code></pre>
  
  <p>Can you help me to add <code>groupBy("column1", "column2").count()</code> to the dataframe? (Since I need to use "count" column for training the data in future) Thanks.</p>