オブジェクト型を一気にラベルエンコーディングする方法 2020年5月17日 / 1 min read View more blogs with the tag pandas , View more blogs with the tag python Table of Contents #はじめに #方法 はじめに Pythonでオブジェクト型を一気にラベルエンコーディングする方法です。 方法 from sklearn.preprocessing import LabelEncoder le = LabelEncoder() for col in df.columns: if df[col].dtype == 'object': df[col] = le.fit_transform(df[col])