title: Multiple Pivots on Diff Columns in PySpark Frames
body: <p>I have a py-spark dataframe , with 8 columns. </p>
  
  <p>DataFrame has columns:</p>
  
  <hr>
  
  <pre><code>Columns  L ,  W , PN , PV , CP , CH , RP , RH 
  Row1     L1,  W1, PN1, PV1, CP1, CH1, RP1, RH1  
  Row2     L2,  W2, PN2, PV2, CP2, CH2, RP2, RH2 
  </code></pre>
  
  <hr>
  
  <p>Columns L, W form the key for the dataset.</p>
  
  <p>I want to pivot the DataSet to the form:</p>
  
  <hr>
  
  <pre><code>Columns L ,  W , PN1 , PN2 , CP1 , CP2 , RP1 , RP2
  Row1    L1,  W1, PV1 ,  -  , CH1 ,  -  , RH1 , - 
  Row2    L2,  W2,  -  , PV2 ,  -  , CH2 ,  -  , RH2
  </code></pre>
  
  <hr>
  
  <p>Fundamentally I have to pivot 3 diff columns, with 3 different statistics( e.g.: Min, max, Mean). </p>
  
  <p>What is the best possible way to pivot this dataset in pyspark?</p>
  
  <p>Thanks,
  P Ved</p>