title: How to stack two columns into a single one in PySpark?
body: <p>I have the following PySpark DataFrame:</p>
  
  <pre><code>id   col1   col2
  A    2      3
  A    2      4
  A    4      6
  B    1      2
  </code></pre>
  
  <p>I want to stack <code>col1</code> and <code>col2</code> in order to get a single column as follows:</p>
  
  <pre><code>id   col3
  A    2   
  A    3
  A    4
  A    6
  B    1
  B    2
  </code></pre>
  
  <p>How can I do so?</p>
  
  <pre><code>df = (
      sc.parallelize([
          (A, 2, 3), (A, 2, 4), (A, 4, 6),
          (B, 1, 2),
      ]).toDF(["id", "col1", "col2"])
  )
  </code></pre>