title: Building a DataFrame with column names in Python
body: <p>In trying to get familiar with DataFrame in Python I got stuck in the following step...</p>
  
  <p>I try to create a dataframe from an array:</p>
  
  <pre><code>from numpy import *
  import pandas as pd
  
  dat = array([[0.3888888888888889, 0.3888888888888889, 0.3888888888888889, 0.436943311456892, 0.7905900031193156, 0.5020468092219706, 0.8389717734280283, 0.7604923090797432, 0.8206054422776056, '0'],
  [0.3888888888888889, 0.3888888888888889, 0.2222222222222222, 0.4457200178477334, 0.8114779465247448, 0.506899600792241, 0.8368566485573798, 0.760617288778523, 0.8195489478905984, '1'],
  [0.2777777777777778, 0.2777777777777778, 0.05555555555555555, 0.4426231291814084, 0.7883413226205706, 0.5037172133121759, 0.8370362549229062, 0.7599752704033258, 0.8184218722901648, '2'],
  [0.1111111111111111, 0.1111111111111111, 0.16666666666666666, 0.4651807845446571, 0.7983379003654792, 0.5250604537887904, 0.8463875215362144, 0.7533582308429306, 0.8241548325954007, '3'],
  [0.5000000000000001, 0.5000000000000001, 0.3333333333333333, 0.4457200178477334, 0.7878040593905666, 0.506899600792241, 0.8368566485573798, 0.7605016058324149, 0.8195489478905984, '4'],
  [0.3888888888888889, 0.3888888888888889, 0.2222222222222222, 0.44943322185630036, 0.7843622888520198, 0.5055757644148106, 0.8351253941103399, 0.7604171267769607, 0.8185442945328569, '5'],
  [0.3888888888888889, 0.3888888888888889, 0.3333333333333333, 0.4424914587425397, 0.7877430312713435, 0.5029950110274568, 0.836692391332608, 0.760611529525946, 0.8198150075184326, '6'],
  [0.3333333333333333, 0.05555555555555555, 0.7777777777777778, 0.4389415113841421, 0.7878040593905666, 0.506899600792241, 0.8368566485573798, 0.7605016058324149, 0.8195489478905984, '7'],
  [0.4444444444444444, 0.4444444444444444, 0.4444444444444444, 0.42770705188736874, 0.7976039510596705, 0.5057230657076256, 0.8368566485573798, 0.7605016058324149, 0.8195489478905984, '8'],
  [0.2222222222222222, 0.2777777777777778, 0.5000000000000001, 0.43182322765312314, 0.7971732873351607, 0.5072390458086798, 0.84541364942531, 0.7613416598875292, 0.8239037851005895, '9']])
  
  dat = pd.DataFrame([dat], columns = ["Var 1", "Var 2", "Var 3", "Var 4", "Var 5", "Var 6", "Var 7", "Var 8", "Var 9", "Var 10"])
  </code></pre>
  
  <p>... and I get the following error:</p>
  
  <pre><code>---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-68-e8aa575cd3c7&gt; in &lt;module&gt;()
  ----&gt; 1 dat = pd.DataFrame([dat], columns = ["Var 1", "Var 2", "Var 3", "Var 4", "Var 5", "Var 6", "Var 7", "Var 8", "Var 9", "Var 10"])
  
  C:\Anaconda3\lib\site-packages\pandas\core\frame.py in __init__(self, data, index, columns, dtype, copy)
      277                 else:
      278                     mgr = self._init_ndarray(data, index, columns, dtype=dtype,
  --&gt; 279                                              copy=copy)
      280             else:
      281                 mgr = self._init_dict({}, index, columns, dtype=dtype)
  
  C:\Anaconda3\lib\site-packages\pandas\core\frame.py in _init_ndarray(self, values, index, columns, dtype, copy)
      410         # by definition an array here
      411         # the dtypes will be coerced to a single dtype
  --&gt; 412         values = _prep_ndarray(values, copy=copy)
      413 
      414         if dtype is not None:
  
  C:\Anaconda3\lib\site-packages\pandas\core\frame.py in _prep_ndarray(values, copy)
     5323         values = values.reshape((values.shape[0], 1))
     5324     elif values.ndim != 2:
  -&gt; 5325         raise ValueError('Must pass 2-d input')
     5326 
     5327     return values
  
  ValueError: Must pass 2-d input
  </code></pre>
  
  <p>Python is still very unfamiliar to me, but I was trying to follow <a href="https://stackoverflow.com/a/20763459/4089351">this post</a>.</p>