title: Split the index into separate columns in pandas
body: <p>I have a large dataframe from which I get the data I need with <code>groupby</code>. I need to get several separate columns from the index of new dataframe.</p>
  
  <p>Part of the original dataframe looks like this:</p>
  
  <pre><code>        code         place     vl   year    week
  0   111.0002.0056   region1     1   2017    29
  1   112.6500.2285   region2     1   2017    31
  2   112.5600.6325   region2     1   2017    30
  3   112.5600.6325   region2     1   2017    30
  4   112.5600.8159   region2     1   2017    30
  5   111.0002.0056   region2     1   2017    29
  6   111.0002.0056   region2     1   2017    30
  7   111.0002.0056   region2     1   2017    28
  8   112.5600.8159   region3     1   2017    31
  9   112.5600.8159   region3     1   2017    28
  10  111.0002.0114   region3     1   2017    31
  ....
  </code></pre>
  
  <p>After applying <code>groupby</code>, it looks like this (code: <code>df_test1 = df_test.groupby(['code' , 'year', 'week',  'place'])['vl'].sum().unstack(fill_value=0)</code>):</p>
  
  <pre><code>                        place  region1  region2  region3  region4  index1
  code            year    week                    
  111.0002.0006   2017     29       0        3        0        0     (111.0002.0006, 2017, 29)
                           30       0        7        0        0     (111.0002.0006, 2017, 30)
  111.0002.0018   2017     29       0        0        0        0     (111.0002.0018, 2017, 29)
  111.0002.0029   2017     30       0        0        0        0     (111.0002.0029, 2017, 30)
  111.0002.0055   2017     28       0        33       0        8     (111.0002.0055, 2017, 28)
                           29       1        155      2        41    (111.0002.0055, 2017, 29)
                           30       0        142      1        39    (111.0002.0055, 2017, 30)
                           31       0        31       0        13    (111.0002.0055, 2017, 31)
  111.0002.0056   2017     28       9        36       0        4     (111.0002.0056, 2017, 28)
                           29       20       75       2        37    (111.0002.0056, 2017, 29)
                           30       17       81       2        33    (111.0002.0056, 2017, 30)
  ....
  </code></pre>
  
  <p>I save the index in a separate column <code>index1</code> (code: <code>df_test1['index1'] = df_test1.index</code>)
  I need to get out of the column <code>index1</code> three separate columns <code>code</code>, <code>year</code> and <code>week</code>.</p>
  
  <p>The result should look like this:</p>
  
  <pre><code>region1 region2 region3 region4       code     year  week                   
     0       3       0       0    111.0002.0006  2017   29
     0       7       0       0    111.0002.0006  2017   30
     0       0       0       0    111.0002.0018  2017   29
     0       0       0       0    111.0002.0029  2017   30
     0       33      0       8    111.0002.0055  2017   28
     1       155     2       41   111.0002.0055  2017   29
     0       142     1       39   111.0002.0055  2017   30
     0       31      0       13   111.0002.0055  2017   31
  ....
  </code></pre>
  
  <p>I would be grateful for any advice!</p>