Suraj Rampure
from datascience import *
import numpy as np
Table.interactive_plots()
pres = Table.read_table('data/president_primary_polls.csv')
pres
pres.group('pollster')
# Selecting only relevant rows and columns
pres = pres.where('pollster', 'McLaughlin & Associates') \
.select('start_date', 'end_date', 'party', 'candidate_name', 'pct')
pres
pres.where('party', 'DEM') \
.pivot('start_date', 'candidate_name', 'pct', sum) \
.select('candidate_name', '12/9/20', '2/24/21', '4/8/21') \
.sort('4/8/21', descending = True) \
.barh('candidate_name',
title = '2024 Democratic Primary Polls (McLaughlin & Associates)',
xaxis_title = '%',
yaxis_title = 'Candidate',
width = 950, height = 700)
This dataset, downloaded from FiveThirtyEight contains information from various pollsters regarding the 2024 federal election primaries for both Democrats and Republicans.
The above visualization contains the results of McLaughin & Associates' polls for the Democratic primaries on December 9th, 2020, February 24th, 2021, and April 8th, 2021. It appears that while Michelle Obama was the early favorite, Kamala Harris is now the leading candidate per the polls. Gavin Newson made an entrance to the list in the most recent poll.