title: Pandas + Patsy + Statsmodels Linear Reg issue passing in categorical variable (duplicate rows)
body: <p>[Preface: I now realize I should've used a classification model (maybe decision tree) instead but I ended up using a linear regression model.]</p>
  
  <p>I had a pandas dataframe as such:</p>
  
  <p><img src="https://i.stack.imgur.com/K6zug.png" alt="enter image description here"></p>
  
  <p>And I want to predict audience score using genre, year, tomato-meter score. But as is constructed, the genres for each movie came in a list, so I felt the need to isolate each genre to pass each genre into my model as separate variables.</p>
  
  <p>After doing such, my modified dataframe looks like this, with duplicate rows for each movie, but each genre element of that movie isolated (just one movie pulled from the dataframe to show):</p>
  
  <p><img src="https://i.stack.imgur.com/0upUm.png" alt="enter image description here"></p>
  
  <p>Now, my question is, can I pass in this second dataframe as is to Patsy and statsmodel linear regression, or will the row duplication introduce bias into my model?</p>
  
  <pre><code>y1, X1 = dmatrices('Q("Audience Score") ~ Year + Q("Tomato-meter") + Genre',
                     data=DF2, return_type='dataframe')
  </code></pre>
  
  <p>In summary, looking for a way for patsy and my model to recognize treat each genre as separate variables.. but want to make sure I'm not fudging the numbers/model by passing in a dataframe in this format as the data (as not every movie as the same # of genres).</p>