[Python] Count of specific value of column in group

Discussão em 'Python' iniciado por Stack, Setembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to achieve the following:

    aggregate_commitment_df = commitment_df.group_by("sprint_start_date", "squad").agg(
    stories_committed=pl.count(pl.col("issue_type") == "Story"),
    spikes_committed=pl.count(pl.col("issue_type") == "Spike"),
    bugs_committed=pl.count(pl.col("issue_type") == "Bug"),
    story_points_committed=pl.sum("story_points"),
    )


    where, for example, stories_committed will be the count of all rows with issue_type == "Story" for each sprint_start_date and squad.

    Continue reading...

Compartilhe esta Página