title: Constructing 3D Pandas DataFrame
body: <p>I'm having difficulty constructing a 3D DataFrame in Pandas. I want something like this</p>
  
  <pre><code>A               B               C
  start    end    start    end    start    end ...
  7        20     42       52     90       101
  11       21                     213      34
  56       74                     9        45
  45       12
  </code></pre>
  
  <p>Where <code>A</code>, <code>B</code>, etc are the top-level descriptors and <code>start</code> and <code>end</code> are subdescriptors. The numbers that follow are in pairs and there aren't the same number of pairs for <code>A</code>, <code>B</code> etc. Observe that <code>A</code> has four such pairs, <code>B</code> has only 1, and <code>C</code> has 3.</p>
  
  <p>I'm not sure how to proceed in constructing this DataFrame. Modifying <a href="https://stackoverflow.com/questions/14916358/reshaping-dataframes-in-pandas-based-on-column-labels">this</a> example didn't give me the designed output:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  
  A = np.array(['one', 'one', 'two', 'two', 'three', 'three'])
  B = np.array(['start', 'end']*3)
  C = [np.random.randint(10, 99, 6)]*6
  df = pd.DataFrame(zip(A, B, C), columns=['A', 'B', 'C'])
  df.set_index(['A', 'B'], inplace=True)
  df
  </code></pre>
  
  <p>yielded:</p>
  
  <pre><code>                C
   A          B   
   one        start   [22, 19, 16, 20, 63, 54]
                end   [22, 19, 16, 20, 63, 54]
   two        start   [22, 19, 16, 20, 63, 54]
                end   [22, 19, 16, 20, 63, 54]
   three      start   [22, 19, 16, 20, 63, 54]
                end   [22, 19, 16, 20, 63, 54]
  </code></pre>
  
  <p>Is there any way of breaking up the lists in C into their own columns?</p>
  
  <p>EDIT: The structure of my <code>C</code> is important. It looks like the following:</p>
  
  <pre><code> C = [[7,11,56,45], [20,21,74,12], [42], [52], [90,213,9], [101, 34, 45]]
  </code></pre>
  
  <p>And the desired output is the one at the top. It represents the starting and ending points of subsequences within a certain sequence (<code>A</code>, <code>B</code>. <code>C</code> are the different sequences). Depending on the sequence itself, there are a differing number of subsequences that satisfy a given condition I'm looking for. As a result, there are a differing number of start:end pairs for <code>A</code>, <code>B</code>, etc</p>