オブジェクト型を一気にラベルエンコーディングする方法2020/5/17 / 1 min readView more blogs with the tag pandas, View more blogs with the tag pythonTable 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])