title: pandas converting column names to variables efficiently
body: <p>I do have following dataframe:</p>
  
  <pre><code>{'2003-12-02LVDT0023': {0: 2.3407617000000001e-06,
    1: 2.3402380999999998e-06,
    2: 2.3410341000000001e-06,
    3: 2.3417209999999999e-06,
    4: 2.3419282000000002e-06,
    5: 2.3420178e-06,
    6: 2.3424012999999999e-06},
   '2003-12-02LVDT0024': {0: 2.3612594999999998e-06,
    1: 2.3609533999999999e-06,
    2: 2.3611187000000002e-06,
    3: 2.3618049e-06,
    4: 2.3621773999999998e-06,
    5: 2.3626039000000002e-06,
    6: 2.3625455000000001e-06},
   '2003-12-02LVDT0025': {0: 2.3660825000000001e-06,
    1: 2.3660903000000001e-06,
    2: 2.3659481000000001e-06,
    3: 2.3661921e-06,
    4: 2.3668378999999998e-06,
    5: 2.3671985e-06,
    6: 2.3679653999999999e-06},
   '2003-12-02force0023': {0: 2.3664842999999999e-06,
    1: 2.3664650000000002e-06,
    2: 2.3666738999999999e-06,
    3: 2.3665972999999999e-06,
    4: 2.3670195e-06,
    5: 2.3675174999999997e-06,
    6: 2.3677449e-06},
   '2003-12-02force0024': {0: 2.3680921e-06,
    1: 2.3682342000000004e-06,
    2: 2.3684212999999998e-06,
    3: 2.3688697000000001e-06,
    4: 2.3694958999999999e-06,
    5: 2.3698856000000002e-06,
    6: 2.3702362000000002e-06},
   '2003-12-02force0025': {0: 2.3684941000000001e-06,
    1: 2.3691163999999997e-06,
    2: 2.3693348999999999e-06,
    3: 2.3694661000000002e-06,
    4: 2.3701970999999998e-06,
    5: 2.3704627000000002e-06,
    6: 2.3707437000000001e-06}}
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/ui2jh.png" alt="enter image description here"></p>
  
  <p>I would like to reshape the dataframe in a way, that I do have one column for each data point (the last digits in the headers) and for each data point two additional columns (<code>lvdt</code>, and <code>force</code>). The dataframe itself has 40000 rows.</p>
  
  <p>What partly works with this tiny data is:</p>
  
  <pre><code># I cannot use `inplace=True` here
  new = new.unstack().reset_index()
  new['id'] = new.level_0.str[-4:]
  new = new.convert_objects(convert_numeric=True)
  new
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/RFeP2.png" alt="enter image description here"></p>
  
  <p>Which gives me the last four digits of the columns as new column. From here on I might be able to somehow reshape the dataframe. But doing that on the original dataframe results in a new dataframe with 15640000 rows and additional 1 GB of ram consumed.</p>
  
  <p>What I want is a dataframe like:</p>
  
  <pre><code>index    force    lvdt    id
  0    0.002    0.002    23
  1    0.002    0.002    24
  </code></pre>