title: How can I use pandas get_dummies() for new data?
body: <p>I am trying to build a sentiment classifier with keras and to evaluate it on different datasets. My problem is that when I try to evaluate it on a different dataset the get_dummies values are different.</p>
  
  <p>I have 5 sentiments: hate, happiness, anger, neutral and sadness distributed as follows: [1 0 0 0 0], [0 1 0 0 0], [0 0 1 0 0], [0 0 0 1 0] and [0 0 0 0 1].</p>
  
  <p>When I try to predict on another dataset, for hate it uses for example [0 0 1 0 0] instead of [1 0 0 0 0]. And so the val_acc and val_loss are not relevant and very bad.</p>
  
  <p>Is there a way I can reindex the get dummies? I can't figure it out how can I do this.</p>
  
  <p>I use the method like this:</p>
  
  <pre><code>tweets = pd.read_csv('data/text_emotion.csv', usecols=[0, 1, 3], names=['id', 'sentiment', 'text'], header=0, encoding="latin-1")
  ...
  y = pd.get_dummies(tweets['sentiment']).values
  </code></pre>
  
  <p>Thank you in advance!</p>