title: Plotting Histogram for all columns in a Data Frame
body: <p>I am trying to draw histograms for all of the columns in my data frame.
  I imported <code>pyspark</code> and <code>matplotlib</code>. 
  df is my data frame variable.
  plt is <code>matplotlib.pyplot</code> variable</p>
  
  <p>I was able to draw/plot histogram for individual column, like this:</p>
  
  <pre><code>bins, counts = df.select('ColumnName').rdd.flatMap(lambda x: x).histogram(20)
  plt.hist(bins[:-1], bins=bins, weights=counts)
  </code></pre>
  
  <p>But when I try to plot it for all variables I am having issues. Here is the for loop I have so far:</p>
  
  <pre><code>for x in range(0, len(df.columns)):
      bins, counts = df.select(x).rdd.flatMap(lambda x: x).histogram(20)
      plt.hist(bins[:-1], bins=bins, weights=counts)
  </code></pre>
  
  <p>How would I do it? Thanks in advance.</p>