[Python] Groupby funciton in Python to output weighed survey value

Discussão em 'Python' iniciado por Stack, Fevereiro 3, 2025.

  1. Stack

    Stack Membro Participativo

    I'm looking to produce a weighted value of the following variable:

    df.satisfaction.value_counts()

    Satisfied 74
    Dissatified 33
    Don't know 4
    Name: satisfaction, dtype: int64


    I've used the groupby function as follows:

    df.groupby('satisfaction').agg('sum')


    However, this outputs all of the variables. Is there a way of selecting just the weight variable?

    Is there an alternative that I should know about?

    Continue reading...

Compartilhe esta Página