📜  get_dummies - Python 代码示例

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

代码示例3
#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