tylerponticelli / intro-data-capstone-biodiversity

0 stars 0 forks source link

wrong lambda function #1

Open sen1 opened 6 years ago

sen1 commented 6 years ago

https://github.com/tylerponticelli/intro-data-capstone-biodiversity/blob/3b4ea4fbd6679feba67bfeedb3ac77e0f110c9f4/codeacademy/readme.txt#L112-L114

I am not sure you can use in on a dataframe. I would do:

species['is_sheep'] = species.common_names.apply(lambda x: 'Sheep' in x)

This also saves you the axis=1 argument because you are using apply function to a pandas series object, not to a dataframe.