title: shape of pandas dataframe to 3d array
body: <p>I want to convert pandas dataframe to 3d array, but cannot get the real shape of the 3d array:</p>
  
  <pre><code>df = pd.DataFrame(np.random.rand(4,5), columns = list('abcde'))
  df['a'][3:]=1
  df['a'][:3]=2
  a3d = np.array(list(df.groupby('a').apply(pd.DataFrame.as_matrix)))
  a3d.shape
  (2,)
  </code></pre>
  
  <p>But, when I set as this, I can get the shape</p>
  
  <pre><code>df = pd.DataFrame(np.random.rand(4,5), columns = list('abcde'))
  df['a'][2:]=1
  df['a'][:2]=2
  a3d = np.array(list(df.groupby('a').apply(pd.DataFrame.as_matrix)))
  a3d.shape
  (2,2,5)
  </code></pre>
  
  <p>Is there some thing wrong with the code?
  Thanks!</p>