title: How to build a histogram in pyspark
body: <p>I have a large pyspark dataframe and want a histogram of one of the columns.  </p>
  
  <p>I can do:</p>
  
  <pre><code>df.select.("col").rdd.flatMap(lambda x: x).histogram(100)
  </code></pre>
  
  <p>but this is very slow, seems to convert the dataframe to an rdd, and I am not even sure why I need the flatMap.</p>
  
  <p>What is the best/fastest way to achieve this?</p>