title: Adding a new column in Data Frame derived from other columns (Spark)
body: <p>I'm using Spark 1.3.0 and Python. I have a dataframe and I wish to add an additional column which is derived from other columns. Like this,</p>
  
  <pre><code>&gt;&gt;old_df.columns
  [col_1, col_2, ..., col_m]
  
  &gt;&gt;new_df.columns
  [col_1, col_2, ..., col_m, col_n]
  </code></pre>
  
  <p>where </p>
  
  <pre><code>col_n = col_3 - col_4
  </code></pre>
  
  <p>How do I do this in PySpark?</p>