0

Can anyone please tell me what does code does

Can anyone explain to me how this code works: df['male'] = df['Sex'] == 'male'

12th Jul 2020, 4:35 AM
Aditya Krishnan Mohan
Aditya Krishnan Mohan - avatar
3 Answers
+ 3
Set the row value of male column is true, if the value of sex column is "male" for the given DataFrame, df. Edit: example, Sex male ---------------- 1 male True 2 female False 3 male True
12th Jul 2020, 4:55 AM
Esch
Esch - avatar
0
Esch Perfect answer.
22nd Jul 2020, 4:12 PM
$¢𝐎₹𝔭!𝐨𝓝
$¢𝐎₹𝔭!𝐨𝓝 - avatar