[Python] Get maximum of value_counts after groupby

Discussão em 'Python' iniciado por Stack, Maio 23, 2025.

  1. Stack

    Stack Membro Participativo

    data.groupby(['batsman'])['runs'].value_counts() gives the following result;


    How do I find out which player has scored the most number of 0's, 1's, 2's, 3's ..etc?

    AB de Villiers 0 29
    1 14
    4 6
    2 3
    6 1
    Abdur Razzak 0 13
    1 5
    2 1
    Adam Gilchrist 0 47
    1 38
    4 17
    2 9
    6 7
    3 1
    Aftab Ahmed 1 51
    ...
    Younis Khan 0 61
    1 39
    4 10
    2 9
    6 5

    Continue reading...

Compartilhe esta Página