title: Hierarchical indexing of Panda's dataframe using an n-d numpy array for indices
body: <p>I need to read parametric data from a csv file into a DataFrame for statistical analysis. I would like to use hierarchical indexing. I have 10 groups of parameters with a total of 70 variations. A sample cut of the excel representation:</p>
  <p><a href="https://i.stack.imgur.com/2a48P.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2a48P.png" alt="Sample Excel representation" /></a></p>
  <p>I tried building the df using an n-d nparray to avoid defining the tuples manually but got lost between using arrays, from_product, merging multiple data frames per parameter and so:</p>
  <pre><code>params = np.array([[['Baseline'], ['orig']]
                         , [['Threshold'], ['Thresh-2', 'Thresh+2', 'Thresh_marg', 'Thresh_cort']]
                         , [['Marker'], ['MHx-2', 'MHx+2', 'MHz-2', 'MHz+2', 'MTx-2', 'MTx+2', 'MTz-2', 'MTz+2', 'MSx-2', 'MSx+2', 'MSz-2', 'MSz+2']]])
  
  rows = []
  df = []
  paramLen = 0
  paramdf = pd.DataFrame()
  for i in range(len(params)):
      paramLen += len(params[i][1])
      rows.append(pd.MultiIndex.from_product(params[i]))
      df.append(pd.DataFrame(np.zeros(len(params[i][1])), index = rows[i]))
      paramdf = pd.concat([paramdf, df[i]])
  </code></pre>
  <p>Is there a way to use the n-d array directly for indexing?</p>