title: pandas reshape tuples - cannot reindex form duplicate axis
body: <p>For a pandas dataframe of:</p>
  
  <p><a href="https://i.stack.imgur.com/vq8m7.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vq8m7.png" alt="enter image description here"></a></p>
  
  <p>defined by:</p>
  
  <pre><code>import pandas as pd
  df = pd.DataFrame({'id':[1,2,3], 're_foo':[1,2,3], 're_bar':[4,5,6], 're_foo_baz':[0.4, 0.8, .9], 're_bar_baz':[.4,.5,.6], 'iteration':[1,2,3]})
  display(df)
  </code></pre>
  
  <p>I want to reshape to the following format:</p>
  
  <pre><code>id, metric_kind, foo      , bar      , iteration
  1, regular     , 1        , 4        , 1
  1, baz         , 0.4    , 0.4        , 1
  ...
  </code></pre>
  
  <p>From <a href="https://stackoverflow.com/questions/60376909/pandas-reshape-multiple-columns-fails-with-keyerror#60377228">pandas reshape multiple columns fails with KeyError</a> I learned that: </p>
  
  <pre><code>df.set_index(['id','iteration']).stack()#.reset_index().rename(columns={'level_2':'metric', 0: 'value'})
  </code></pre>
  
  <p>will output different tuples, but I want to keep both values of the tuple in a row.</p>
  
  <pre><code>dx = df[['id', 'foo', 'bar', 'iteration']].copy()
  dx['kind'] = 'regular'
  dx = pd.concat([dx, df[['id', 'foo_baz', 'bar_baz', 'iteration']]], axis=0)
  dx['kind'] = dx['kind'].fillna('baz')
  dx.loc[dx.foo.isnull(), 'foo'] = dx.foo_baz
  # now fill other NULL values
  </code></pre>
  
  <p>Would fail with a:</p>
  
  <pre><code>ValueError: cannot reindex from a duplicate axis
  instead.
  </code></pre>
  
  <h2>edit</h2>
  
  <p>I see that a smarter fillna:</p>
  
  <pre><code>dx.foo = dx.foo.fillna(dx.foo_baz)
  dx.bar = dx.bar.fillna(dx.bar_baz)
  dx = dx.drop(['foo_baz', 'bar_baz'], axis= 1)
  </code></pre>
  
  <p>get's the job done - but this seems really clumsy. Is there a better way?</p>