Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

df create dummy from multiple category

from sklearn.preprocessing import MultiLabelBinarizer

mlb = MultiLabelBinarizer()
# get dummy array
dummy = mlb.fit_transform(df['cat'].str.split('|'))
# get category list 
mlb.classes_
 
PREVIOUS NEXT
Tagged: #df #create #dummy #multiple #category
ADD COMMENT
Topic
Name
1+2 =