title: Python/pyspark data frame rearrange columns
body: <p>I have a data frame in python/pyspark with columns <code>id</code> <code>time</code> <code>city</code> <code>zip</code> and so on......</p>
  
  <p>Now I added a new column <code>name</code> to this data frame.</p>
  
  <p>Now I have to arrange the columns in such a way that the <code>name</code> column comes after <code>id</code></p>
  
  <p>I have done like below</p>
  
  <pre><code>change_cols = ['id', 'name']
  
  cols = ([col for col in change_cols if col in df] 
          + [col for col in df if col not in change_cols])
  
  df = df[cols]
  </code></pre>
  
  <p>I am getting this error</p>
  
  <pre><code>pyspark.sql.utils.AnalysisException: u"Reference 'id' is ambiguous, could be: id#609, id#1224.;"
  </code></pre>
  
  <p>Why is this error occuring. How can I rectify this.</p>