Can anyone please tell me what does code does | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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
2 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