I have got sample dataframe as below. And now trying to find % of Low income group in each country.
Output:
One solution would be :
(DF.Country[DF["Income"] == "Low"].value_counts() * 100 / DF.Country.value_counts())
Another is: Add third column in DF with True/False value against each record if Income='Low'. and then calculate mean.
Is there any better approach to achieve this?