Open cyouh95 opened 6 years ago
Alternatively, you could simplify the following line:
species['is_sheep'] = species.common_names.apply(lambda name: True if 'Sheep' in name else False)
to:
species['is_sheep'] = species.common_names.apply(lambda name: 'Sheep' in name)
'Sheep' in name itself would resolve to either True or False, and that would be returned in the lambda function.
'Sheep' in name
True
False
Alternatively, you could simplify the following line:
to:
'Sheep' in name
itself would resolve to eitherTrue
orFalse
, and that would be returned in the lambda function.