python pandas\numpy encode unique by integers : <p>Say I have <code>x=["apple","orange","orange","apple","pear"]</code> I would like to have a categorical representation with integers e.g. <code>y=[1,2,2,1,3]</code>. What would be the best way to do so?</p>
