df = pd.get_dummies(df, columns=['type'])
#this do dummie verable do a very intersting thing they turn calegorical
#variables in numerical like M and F they can 0 for M and 1 for F
pd.get_dummies(df.Gender)
F M
0 0 1
1 1 0
2 1 0
3 0 1
4 1 0
... ... ...
202 1 0
203 0 1
204 0 1
205 0 1
206 1 0
207 rows × 2 columns
df = pd.get_dummies(df, columns=['col1', 'col2', 'col3'])
>>> s = pd.Series(list('abca'))
>>> pd.get_dummies(s)
a b c
0 1 0 0
1 0 1 0
2 0 0 1
3 1 0 0
>>> pd.get_dummies(pd.Series(list('abcaa')), drop_first=True)
b c
0 0 0
1 1 0
2 0 1
3 0 0
4 0 0
>>> pd.get_dummies(pd.Series(list('abc')), dtype=float)
a b c
0 1.0 0.0 0.0
1 0.0 1.0 0.0
2 0.0 0.0 1.0