title: pandas - set new index level for multiindex series
body: <p><strong>I have a pandas series with MultiIndex and would like to replace one of the levels with the values in a seperate list</strong>. I found a workaround how to achieve this, but I was wondering if there is a more direct way of doing this. This question also relates to the working of <code>set_levels()</code>, which I seemingly do not understand.</p>
  
  <p>Here is my Series</p>
  
  <pre><code>&gt;&gt;&gt; res
  name     StringNum
  A         2013         3203
            4135          579
            7881        30600
            7890          575
            9067        30600
            9233        30600
  B         5378        30600
            7881        30600
  C         5121        30600
  ...
  N         9895         3935
  U         1270        30600
            3049        30600
  Length: 4213, dtype: float64
  </code></pre>
  
  <p>I have a list <code>RepNum</code> </p>
  
  <pre><code>&gt;&gt;&gt; RepNum[:7]
  ['2013_x', '4135_y', '7881_x', '7890_x', '9067_z', '9233_w', '5378_y']
  </code></pre>
  
  <p>which values I would like to substitute for the index values of <code>StringNum</code>.
  Right now I achieve this as follows</p>
  
  <pre><code>newres = pd.concat([res,pd.Series(res.index.get_level_values('name').tolist(),index=res.index),pd.Series(RepNum,index=res.index)],axis=1)
  newres.set_index([1,2],inplace=True)
  newres.index.names = ['name','StringNum']
  &gt;&gt;&gt; newres
                    0
  name     StringNum            
  A        2013_x   3203
           4135_y    579
           7881_x  30600
           7890_x    57
           9067_z  30600
           9233_w  30600
  B        5378_y  30600
           7881_y  30600
  C        5121_z  30600
  ...
  </code></pre>
  
  <p>which is what I want to get. I would have thought, though, that <code>res.index.set_levels([res.index.get_level_values('name').tolist(),RepNum],inplace=True)</code> would do the same in a more elegant and practical way, but the resulting series displays the wrong index values to the corresponding column entries</p>
  
  <pre><code>name     StringNum     
  A        7890_x     3203
           9147_b      579
           5113_x    30600
           5134_v      575
           7289_w    30600
           9543_b    30600
           9895_y    30600
           5113_x    30600
           7003_v    30600
           9067_z      624
           7804_w    30600
  ...
  </code></pre>
  
  <p>You can also see that <code>name A</code> has much more entries now, than it actually has (<code>A</code> has only 6 entries in the original series). Btw, the same wrong result is obtained trying <code>res = pd.Series(res.values, index=NewIndex)</code>, where <code>NewIndex = pd.MultiIndex.from_arrays([res.index.get_level_values('name').tolist(),RepNum], names=('name','number'))</code>. Could someone enlighten me?</p>