pandas get_dummy code example
Example 1: how to get dummies in a dataframe pandas
df = pd.get_dummies(df, columns=['type'])
Example 2: get_dummies python
>>> pd.get_dummies(s)
a b c
0 1 0 0
1 0 1 0
2 0 0 1
3 1 0 0
df = pd.get_dummies(df, columns=['type'])
>>> pd.get_dummies(s)
a b c
0 1 0 0
1 0 1 0
2 0 0 1
3 1 0 0