jasoncfoster / intro-data-capstone-biodiversity

0 stars 0 forks source link

Use nunique #1

Open sen1 opened 6 years ago

sen1 commented 6 years ago

https://github.com/jasoncfoster/intro-data-capstone-biodiversity/blob/14bfe8a623819dc28569ed193253601ea2e3198e/Capstone20171219-JasonFoster/biodiversity.py#L80

The question was "how many species?". If you have ['cow','cow','dog'], count() will return 3 but nunique() will return a 2 which is the correct answer. So the correct answer is:

species.groupby('conservation_status').scientific_name.nunique().reset_index()
jasoncfoster commented 6 years ago

I wasn't thorough enough on that request for sure.