title: How to specify a variable in pandas as ordinal/categorical?
body: <p>I am trying to run some Machine learning algo on a dataset using scikit-learn. My dataset has some features which are like categories. Like one feature is <code>A</code>, which has values <code>1,2,3</code> specifying the quality of something. <code>1:Upper, 2: Second, 3: Third class</code>. So it's an ordinal variable. </p>
  
  <p>Similarly I re-coded a variable <code>City</code>, having three values <code>('London', Zurich', 'New York'</code> into <code>1,2,3</code> but with no specific preference for the values. So now this is a nominal categorical variable. </p>
  
  <p>How do I specify the algorithm to consider these as categorical and ordinal etc. in pandas?. Like in R, a categorical variable is specified by <code>factor(a)</code> and hence is not considered a continuous value. Is there anything like that in pandas/python?</p>