O'Reilly logo
  • Michael Longval thinks this is interesting:

male = training_set[training_set.sex == 'male'] female = training_set[training_set.sex =='female'] womens_survival_rate = float(sum(female.survived))/len(female) mens_survival_rate = float(sum(male.survived))/len(male)

From

Cover of Learning Jupyter

Note

There is an error in the code. The data columns 'sex' and 'survived' should be capitalized. Like this:

male = training_set[training_set.Sex == 'male']
female = training_set[training_set.Sex == 'female']
womens_survival_rate = float(sum(female.Survived))/len(female)
mens_survival_rate = float(sum(male.Survived))/len(male)