Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
411 B
5
Indexable
Never
candidate_votes_top = votes.pivot_table(
    index='candidate', columns='days_from_elections', values='vote', aggfunc='count')
candidate_votes_top['vote_sum'] = candidate_votes_top.sum (axis=1)


candidate_votes_top_20 = candidate_votes_top.sort_values(by='vote_sum', ascending=False).head(20)



candidate_votes_top_20 = candidate_votes_top_20.drop(columns=['vote_sum', '8.0'], axis=1)


candidate_votes_top_20