[Python] Pandas Group by without performing aggregation

Discussão em 'Python' iniciado por Stack, Março 21, 2025.

  1. Stack

    Stack Membro Participativo

    I have a pandas dataframe as follows:

    Athlete ID City No. of Sport Fields
    1231 LA 81
    4231 NYC 80
    2234 NJ 64
    1223 SF 75
    4531 LA 81
    2345 NYC. 80
    ...

    I want to print the City and No. of Sport Fields columns and group by City and sort by No. of Sport Fields. groupby() won't work here because I am not calculating anything.

    Continue reading...

Compartilhe esta Página