title: How can I split a column off of a DataFrame, but keep its association with the initial DataFrame?
body: <p>I have a dataframe <code>dataDF</code> that is: </p>
  
  <pre><code>+-------+------+-----+-----+-----------+
  |TEST_PK| COL_1|COL_2|COL_3|h_timestamp|
  +-------+------+-----+-----+-----------+
  |      1| apple|   10| 1.79|       1111|
  |      1| apple|   11| 1.79|       1114|
  |      2|banana|   15| 1.79|       1112|
  |      2|banana|   16| 1.79|       1115|
  |      3|orange|    7| 1.79|       1113|
  +-------+------+-----+-----+-----------+
  </code></pre>
  
  <p>And I need to run this function:<br>
  <code>operation(row, h_timestamp)</code><br>
  On each row, but <code>row</code> can not contain <code>h_timestamp</code>, so my first thought is to split the dataframe like:  </p>
  
  <pre><code>val columns = dataDF.drop("h_timestamp")  
  val timestamp = dataDF.select("h_timestamp")  
  </code></pre>
  
  <p>But that doesn't help when I want to perform the operation on every row like:  </p>
  
  <pre><code>dataDF.map(row =&gt; {
    ...
    val rowWithoutTimestamp = ???
    val timestamp = ???
    operation(rowWithoutTimestamp, timestamp)
    ...
  })
  </code></pre>
  
  <p>But now those two dataframes are not linked and I don't know how to get the right timestamp for each row. The <code>TEST_PK</code> column is not necessarily unique.<br>
  Is there a way to use <code>.drop()</code> or <code>.select()</code> on just a row or some other way to do this?<br>
  Edit: Also, the table could have any number of columns, but will always have the timestamp column and at least one more that is not the timestamp</p>