title: Move every alternate row of a pandas dataframe to a new column without NaN
body: <p>I have a pandas dataframe that looks like this:</p>
  <pre><code>    A   B
  0   1   a
  1   2   b
  2   3   a
  3   4   b
  4   5   a
  5   6   b
  6   7   a
  7   8   b
  8   9   a
  9   10  b
  </code></pre>
  <p>I want to convert this into a new dataframe that has 2 columns - &quot;a&quot; and &quot;b&quot; with the corresponding row values as columns something like this:</p>
  <pre><code>a   b
  0   1   2
  1   3   4
  2   5   6
  3   7   8
  4   9   10
  </code></pre>
  <p>I tried using the pivot function. While the values did move into the new column, the spaces were replaced by NaN. What is the correct way to do this?</p>
  <pre><code>df.pivot(columns=&quot;B&quot;, values = &quot;A&quot;)
  
  Output:
  B   a   b
  0   1.0 NaN
  1   NaN 2.0
  2   3.0 NaN
  3   NaN 4.0
  4   5.0 NaN
  5   NaN 6.0
  6   7.0 NaN
  7   NaN 8.0
  8   9.0 NaN
  9   NaN 10.0
  </code></pre>
  <pre><code></code></pre>