[Python] Calculate percentage of flag grouped by another column

Discussão em 'Python' iniciado por Stack, Dezembro 20, 2024.

  1. Stack

    Stack Membro Participativo

    I have the following dataframe:

    Account ID​
    Subscription type​
    Cancellation flag​
    123​
    Basic​
    1​
    222​
    Basic​
    0​
    234​
    Hybrid​
    1​
    345​
    Hybrid​
    1​

    Now I would like to calculate the percentage of cancellations, but grouped by the subscription type. I would like to get it in a format so that I can easily create a bar chart out of the percentages grouped by the subscription type.

    Continue reading...

Compartilhe esta Página