title: Converting a data frame into tables with indexes
body: <p>I have the following sample data frame:</p>
  <pre><code>import pandas as pd
  array = {'name': ['John', 'Rob', 'Rob', 'John'], 'color': ['Green', 'Black', 'Blue', 'Black']}
  df = pd.DataFrame(array)
  df
  </code></pre>
  <p>It looks like this:</p>
  <pre><code>    name    color
  0   John    Green
  1   Rob     Black
  2   Rob     Blue
  3   John    Black
  </code></pre>
  <p>I am looking for a way to create three separate tables or data frames:</p>
  <p>Main:</p>
  <pre><code>    name    color
  0    1       1
  1    2       2
  2    2       3
  3    1       2
  </code></pre>
  <p>Names:</p>
  <pre><code>        name
     1    John
     2    Rob
  </code></pre>
  <p>Colors:</p>
  <pre><code>        color
     1    Green
     2    Black
     3    Blue
  </code></pre>