title: Map a dataframe to a column of cartesian products by column name
body: <p>Note: Cartesian product, might not be the right language, since we are working with data, not sets.  It is more like &quot;free product&quot; or &quot;words&quot;.</p>
  <p>There is more than one way to turn a dataframe into a list of lists.</p>
  <p><a href="https://stackoverflow.com/questions/28006793/pandas-dataframe-to-list-of-lists">Here is one way</a></p>
  <p>In that case, the list of lists represents actually a list of columns, where the list index is the row index.</p>
  <p>What I want to do, is take a data frame, select specific columns by name, then produce a new list where the inner lists are cartesian products of the elements from the selected columns.  A simplified example is given here:</p>
  <pre><code>import pandas as pd
  df = pd.DataFrame([[1,2,3],[3,4,5]])
  
  magicMap(df)
  
  df = [[1,3],[2,4],[3,5]]
  </code></pre>
  <p>With column names:</p>
  <pre><code>df # full of columns with names
  magicMap(df, listOfCollumnNames)
  df = [[c1r1,c2r1...],[c1r2, c2r2....], [c1r3, c2r3....]...]
  </code></pre>
  <p>Note: &quot;cirj&quot; is column i row j.</p>
  <p>Is there a simple way to do this?</p>