title: Pyspark: how to duplicate a row n time in dataframe?
body: <p>I've got a dataframe like this and I want to duplicate the row n times if the column <code>n</code> is bigger than one:</p>
  
  <pre><code>A   B   n  
  1   2   1  
  2   9   1  
  3   8   2    
  4   1   1    
  5   3   3 
  </code></pre>
  
  <p>And transform like this:</p>
  
  <pre><code>A   B   n  
  1   2   1  
  2   9   1  
  3   8   2
  3   8   2       
  4   1   1    
  5   3   3 
  5   3   3 
  5   3   3 
  </code></pre>
  
  <p>I think I should use <code>explode</code>, but I don't understand how it works...<br>
  Thanks</p>