title: Pyspark: Dynamically update columns position of a dataframe according to other dataframe
body: <p>I have a requirement to change column positions frequently. instead of changing the code i created a temporary dataframe <code>Index_df</code>. here i will update the column positions and it should reflect on actual dataframe on which the changes should perform.</p>
  
  <p>sample_df</p>
  
  <pre><code>F_cDc,F_NHY,F_XUI,F_NMY,P_cDc,P_NHY,P_XUI,P_NMY
  415    258   854   245   478   278   874   235
  405    197   234   456   567   188   108   267
  315    458   054   375   898   978   677   134
  </code></pre>
  
  <p>Index_df</p>
  
  <pre><code>   col   position
      F_cDc,1 
      F_NHY,3
      F_XUI,5
      F_NMY,7
      P_cDc,2 
      P_NHY,4
      P_XUI,6
      P_NMY,8
  </code></pre>
  
  <p>here according to the <code>index_df</code>,<code>sample_df</code> should change.</p>
  
  <p>Expected output:</p>
  
  <pre><code>F_cDc,P_cDc,F_NHY,P_NHY,F_XUI,P_XUI,F_NMY,P_NMY
  415    478   258   278   854   874   245   235
  405    567   197   188   234   108   456   267
  315    898   458   978   054   677   375   134
  </code></pre>
  
  <p>here column positions are changed according to the positions i have updated in <code>Index_df</code></p>
  
  <p>I could do <code>sample_df.select("&lt;column order&gt;")</code> but i have more than 70 columns. Technically which is not a best way to deal.</p>