title: Convert classes to numeric in a pandas dataframe
body: <p>I' doing a project based on this Kaggle dataset: <a href="https://www.kaggle.com/rush4ratio/video-game-sales-with-ratings/data" rel="noreferrer">https://www.kaggle.com/rush4ratio/video-game-sales-with-ratings/data</a> and I need to put the data into a kNN model, however this can't be done in its current state as I need to transform the string values into integers. </p>
  
  <p>get_dummies isn't ideal as there are loads of categorical data in the dataset and will create thousands of columns. I am looking for a way to transform strings to numeric representations, for example:</p>
  
  <pre><code>Platform || Critic_Score || Publisher || Global_Sales
  Wii      ||      73      ||  Nintendo ||  53
  Wii      ||      86      ||  Nintendo ||  60
  PC       ||      80      ||Activision ||  30
  PS3      ||      74      ||Activision ||  35
  Xbox360  ||      81      ||   2K      ||  38
  </code></pre>
  
  <p>I'd like to transform into this:</p>
  
  <pre><code>Platform || Critic_Score || Publisher || Global_Sales
    1      ||      73      ||     1     ||  53
    1      ||      86      ||     1     ||  60
    2      ||      80      ||     2     ||  30
    3      ||      74      ||     2     ||  35
    4      ||      81      ||     3     ||  38
  </code></pre>
  
  <p>I'm using Python 3. </p>
  
  <p>Thanks.</p>