title: How to get original values after using factorize() in Python?
body: <p>I'm a beginner trying to create a predictive model using Random Forest in Python, using train and test datasets. train["ALLOW/BLOCK"] can take 1 out of 4 expected values (all strings). test["ALLOW/BLOCK"] is what needs to be predicted. </p>
  
  <pre><code>y,_ = pd.factorize(train["ALLOW/BLOCK"])
  
  y
  Out[293]: array([0, 1, 0, ..., 1, 0, 2], dtype=int64)
  </code></pre>
  
  <p>I used <code>predict</code> for the prediction.</p>
  
  <pre><code>clf.predict(test[features])
  
  clf.predict(test[features])[0:10]
  Out[294]: array([0, 0, 0, 0, 0, 2, 2, 0, 0, 0], dtype=int64)
  </code></pre>
  
  <p>How can I get the original values instead of the numeric ones? Is the following code actually comparing the actual and predicted values?</p>
  
  <pre><code>z,_= pd.factorize(test["AUDIT/BLOCK"])
  
  z==clf.predict(test[features])
  Out[296]: array([ True, False, False, ..., False, False, False], dtype=bool) 
  </code></pre>