title: Taking a cross product of Pandas Dataframes
body: <p>I am attempting to take string data from one dataframe and substitute it with numerical values and create a cross product of the results like the following below.</p>
  
  <p>I read the data into dataframes, example input coming below:</p>
  
  <pre class="lang-py prettyprint-override"><code>import pandas as pd
  shoppers = pd.DataFrame({'name': ['bill', 'bob', 'james', 'jill', 'henry'], 
                           'item': ['apple','apple','orange','grapes','orange']})
  
  stores = pd.DataFrame({'apple' : [0.25, 0.20, 0.18], 
                         'orange': [0.30, 0.4, 0.35],
                         'grapes': [1.0, 0.9, 1.1], 
                         'store':  ['kroger', 'publix', 'walmart']})
  </code></pre>
  
  <p>Here's the resulting shoppers dataframe:</p>
  
  <pre><code>         item
  name         
  bill    apple
  bob     apple
  james  orange
  jill   grapes
  henry  orange
  </code></pre>
  
  <p>And here's the resulting stores dataframe:</p>
  
  <pre><code>         apple  orange  grapes
  store                         
  kroger    0.25    0.30     1.0
  publix    0.20    0.40     0.9
  walmart   0.18    0.35     1.1
  </code></pre>
  
  <p>And the desired result is the price each person would pay at each store. For example:</p>
  
  <p><a href="https://i.stack.imgur.com/AUnlD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AUnlD.png" alt="enter image description here"></a></p>
  
  <p>I'm really struggling to find the right way to make such a transformation in Pandas efficiently. I could easily loop over shoppers and stores and build each row in a brute-force manner, but there must be a more efficient way to do this with the pandas API. Thanks for any suggestions.</p>