📜  一种热编码 python pandas - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:04.998000             🧑  作者: Mango

代码示例2
from sklearn.preprocessing import MultiLabelBinarizer

mlb = MultiLabelBinarizer()
df = df.join(pd.DataFrame(mlb.fit_transform(df.pop('Col3')),
                          columns=mlb.classes_,
                          index=df.index))