title: Pandas merge two df
body: <p>I have two DataFrames</p>
  
  <p>df1 has following form</p>
  
  <pre><code>    ID    col1    col2
  0   1     2       10
  1   3     1       21
  </code></pre>
  
  <p>and df2 looks like this</p>
  
  <pre><code>    ID    field1    field2
  0   1     4         1
  1   1     3         3
  2   3     5         4
  3   3     9         5
  4   1     2         0
  </code></pre>
  
  <p>I want to concatenate both DataFrames but so that I have only one line per each ID, so it'd look like this:</p>
  
  <pre><code>    ID   col1    col2   field1_1    field2_1    field1_2    field2_2    field1_3    field2_3
  0   1    2       10     4           1           3           3           2           0
  1   3    1       21     5           4           9           5
  </code></pre>
  
  <p>I have tried merging and pivoting the data <code>df.pivot(index=df1.index, columns='ID')</code>
  But because the length is variable, I become a ValueError.</p>
  
  <p><code>ValueError: all arrays must be same length</code></p>