I have a pandas dataframe with the following categorical variables as columns on the left, and their specific realizations on the right,
(apologies for low-res).
For a statistical regression, I want to label all of these categorical variables, so, for example, in LotShape, Reg becomes 0, IR1 becomes 1, IR2 2, and IR3 3. I found that scikit-learn's LabelEncoder can do the job, but there's a problem. Some of these categorical variables are implicitly ordinal, and 0, 1, ... need to be assigned to the right labels, and LotShape only happens to be in order there.
So my question is, how would I efficiently, in some order that I specify, label a large number of categorical variables?
