title: How to count frequency of each categorical variable in a column in pyspark dataframe?
body: <p>Say I have a pyspark dataframe:</p>
  
  <pre><code>df.show()
  +-----+---+
  |  x  |  y|
  +-----+---+
  |alpha|  1|
  |beta |  2|
  |gamma|  1|
  |alpha|  2|
  +-----+---+
  </code></pre>
  
  <p>I want to count how many occurrence <code>alpha</code>, <code>beta</code> and <code>gamma</code> there are in column <code>x</code>. How do I do this in pyspark?</p>