I have a column of sites: ['Canada', 'USA', 'China' ....]
Each site appears many times in the SITE column, and next to each instance is a true or false value.
INDEX | VALUE | SITE
0 | True | Canada
1 | False | Canada
2 | True | USA
3 | True | USA
And it goes on.
Goal 1: I want to find for each site what percentage of the VALUE column is True.
Goal 2: I want to return a list of sites where% True in the VALUE column is greater than 10%.
How to use groupby to achieve this? I only know how to use groupby to find the average value for each site, which will not help me here.
source
share