what I currently have displayedHelp using Pandas with python to code a small program to display percent of times each car did not stop for gas (represented with NOT) . Using df.groupby and .value_counts to display pic you see. there are only two columns (CAR and GAS) the rest of the numbers are the counts of each trip for each colored car. Im trying to combine everything other than (NOT) and show percentage each car stopped for gas in general and didn't stop for gas showing two results positive and negative for each car. output should look something like:
RED Percentage stopped for gas: 50% Percentage didn't stop for gas: 50% BLUE Percentage stopped for gas: 50% Percentage didn't stop for gas: 50% GREEN Percentage stopped for gas: 50% Percentage didn't stop for gas: 50%
Tried using df.groupby ('CAR').GAS.value_counts().loc[:,'NOT'] and df.groupby ('CAR').GAS.value_counts() creating the list you see but I'm having trouble assigning NOT number to a variable and all other GAS to a positive variable.