Say we are using pandas.get_dummies to dummy coding our categorial variable. My question is how to set the reference level for a categorical variable, so that I can specify which level to drop when I use drop_first argument in get_dummies
? This can be easily done in R, since R has factor datatype. I'm not sure how to do it in pandas. Thanks.
dt = pd.Series(list('abcdab'))
pd.get_dummies(dt, drop_first=True)