title: Pandas: Modify a particular level of Multiindex
body: <p>I have a dataframe with Multiindex and would like to modify one particular level of the Multiindex. For instance, the first level might be strings and I may want to remove the white spaces from that index level:</p>
  
  <pre><code>df.index.levels[1] = [x.replace(' ', '') for x in df.index.levels[1]]
  </code></pre>
  
  <p>However, the code above results in an error:</p>
  
  <pre><code>TypeError: 'FrozenList' does not support mutable operations.
  </code></pre>
  
  <p>I know I can reset_index and modify the column and then re-create the Multiindex, but I wonder whether there is a more elegant way to modify one particular level of the Multiindex directly.</p>