title: Converting numpy ndarray into pandas dataframe with column names and types
body: <p>Edit: As explained below in @floydian's comment, the problem was that calling <code>a = np.array(a, dtype=d)</code> creates an a double array which was causing the problem. </p>
  
  <p>I am aware that this has been already asked multiple times, and in fact am looking at <a href="https://stackoverflow.com/questions/21647054/creating-a-pandas-dataframe-with-a-numpy-array-containing-multiple-types/21647198#21647198">Creating a Pandas DataFrame with a numpy array containing multiple types</a> answer right now. But I still seem to have a problem while converting. It must be something very simple that I am missing. I hope that someone can be so kind and point it out. Sample code below:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  
  a = np.array([[1, 2], [3, 4]])
  d = [('x','float'), ('y','int')]
  a = np.array(a, dtype=d)
  
  # Try 1
  df= pd.DataFrame(a)
  # Result - ValueError: If using all scalar values, you must pass an index
  
  # Try 2
  i = [1,2]
  df= pd.DataFrame(a, index=i)
  # Result - Exception: Data must be 1-dimensional
  </code></pre>