Label encoding across multiple columns in scikit-learn

You can easily do this though, df.apply(LabelEncoder().fit_transform) EDIT2: In scikit-learn 0.20, the recommended way is OneHotEncoder().fit_transform(df) as the OneHotEncoder now supports string input. Applying OneHotEncoder only to certain columns is possible with the ColumnTransformer. EDIT: Since this original answer is over a year ago, and generated many upvotes (including a bounty), I should probably extend … Read more