title: Automated combinatorial DataFrame generation in Python/pandas
body: <p>I'm quite new to pandas and python, and I'm coming from a background in biochemistry and drug discovery. One frequent task that I'd like to automate is the conversion of a list of combination of drug treatments and proteins to a format that contains all such combinations.</p>
  
  <p>For instance, if I have a DataFrame containing a given set of combinations:
  <a href="https://github.com/colinhiggins/dillydally/blob/master/input.csv" rel="nofollow">https://github.com/colinhiggins/dillydally/blob/master/input.csv</a>, I'd like to turn it into <a href="https://github.com/colinhiggins/dillydally/blob/master/output.csv" rel="nofollow">https://github.com/colinhiggins/dillydally/blob/master/output.csv</a> such that each protein (1, 2, and 3) are copied n times to an output DataFrame where the number of rows, n, is the number of drugs and drug concentrations plus one for a no-drug row of each protein. </p>
  
  <p>Ideally, the degree of combination would be dictated by some other table that indicates relationships, for example if proteins 1 and 2 are to be treated with drugs 1, 2, and 3 but that protein 2 isn't treated with any drugs.</p>
  
  <p>I'm thinking some kind of nested for <code>loop</code> is going to be required, but I can't wrap my head around just quite how to start it.</p>