I have this data frame:
df = pd.DataFrame({"A": ["Used", "Not used", "Not used", "Not used", "Used",
"Not used", "Used", "Used", "Used", "Not used"],
"B": ["Used", "Used", "Used", "Not used", "Not used",
"Used", "Not used", "Not used", "Used", "Not used"]})
I would like to find the quickest, cleanest way to find out the following:
- The percentage of rows of all the rows that have used A.
- The percentage of rows of all the rows that have used B.
- The percentage of rows of all the rows that have used A and B.
I am new to Python and pandas (and coding in general), so I am sure this is very simple, but any guidance would be appreciated. I have tried groupby().aggregate(sum) but I did not get the result I needed (I would imagine because these are characters rather than integers.