title: Pandas Dataframe: shift/merge multiple rows sharing the same column values into one row
body: <p>Sorry for any possible confusion with the title. I will describe my question better with the following code and pictures.</p>
  <p>Now I have a dataframe with multiple columns. The first two columns, by which they are sorted, 'Route' and 'ID' (Sorry about the formatting, all the rows here have 'Route' value of '100' and 'ID' from 1 to 3.</p>
  <pre><code>df1.head(9)
    Route ID  Year    Vol Truck_Vol   Truck_%
  0   100 1   2017.0  7016    635.0   9.1
  1   100 1   2014.0  6835    NaN NaN
  2   100 1   2011.0  5959    352.0   5.9
  3   100 2   2018.0  15828   NaN NaN
  4   100 2   2015.0  13114   2964.0  22.6
  5   100 2   2009.0  11844   1280.0  10.8
  6   100 3   2016.0  15434   NaN NaN
  7   100 3   2013.0  18699   2015.0  10.8
  8   100 3   2010.0  15903   NaN NaN
  </code></pre>
  <p>What I want to have is</p>
  <pre><code> Route  ID  Year    Vol1    Truck_Vol1  Truck_%1    Year2   Vol2    Truck_Vol2  Truck_%2    Year3   Vol3    Truck_Vol3  Truck_%3
  0   100 1   2017    7016    635.0   9.1 2014    6835    NaN NaN 2011    5959    352.0   5.9
  1   100 2   2018    15828   NaN NaN 2015    13114   2964.0  22.6    2009    11844   1280.0  10.8
  2   100 3   2016    15434   NaN NaN 2013    18699   2015.0  10.8    2010    15903   NaN NaN
  </code></pre>
  <p>Again, sorry for the messy formatting. Let me try a simplified version.</p>
  <p>Input:</p>
  <pre><code>  Route ID  Year    Vol T_%
  0   100 1   2017    100 1.0
  1   100 1   2014    200 NaN
  2   100 1   2011    300 2.0
  3   100 2   2018    400 NaN
  4   100 2   2015    500 3.0
  5   100 2   2009    600 4.0
  </code></pre>
  <p>Desired Output:</p>
  <pre><code>Route   ID  Year    Vol T_% Year.1  Vol.1   T_%.1   Year.2  Vol.2   T_%.2
  0   100 1   2017    100 1.0 2014    200     NaN     2011    300      2
  1   100 2   2018    400 NaN 2015    500     3.0     2009    600      4
  </code></pre>
  <p>So basically just move the cells shown in the picture</p>
  <p><a href="https://i.stack.imgur.com/fHhdu.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fHhdu.png" alt="Input" /></a></p>
  <p><a href="https://i.stack.imgur.com/DAHKz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DAHKz.png" alt="Output" /></a></p>
  <p>I am stumped here. The names for the newly generated columns don't matter.</p>
  <p>For this current dataframe, I have three rows per 'group' like shown in the code. It will be great if the answer can accommodate any number of rows each group.</p>
  <p>Thanks for your time.</p>