fivethirtyeight / data

Data and code behind the articles and graphics at FiveThirtyEight
https://data.fivethirtyeight.com/
Creative Commons Attribution 4.0 International
16.76k stars 10.95k forks source link

Chance of Winning data over time #79

Closed vitamin23c closed 7 years ago

vitamin23c commented 7 years ago

Can someone please help me with getting the data behind the chance of winning forecast for Clinton and Trump? I tried using data scraping tools, but wouldn't work on the graphs.

http://projects.fivethirtyeight.com/2016-election-forecast/?ex_cid=rrpromo It's under How the forecast has changed, and the latest data as of 10/20 is Clinton for 87.2% and Trump 12.7%. Thank you in advance!

_

RichHatch commented 7 years ago

You mean like this? http://projects.fivethirtyeight.com/2016-election-forecast/summary.json

vitamin23c commented 7 years ago

Thank you for your response, Rich. I tried it, but it wouldn't match the numbers on the graph (e.g. 87.2% (ending point) and 66.4% (starting point) for Clinton. I also wasn't sure how I can find out the date for each data point. Is there another way to get it? Thank you!

cpmsmith commented 7 years ago

It looks like they're being served inline in the page, and stored in the global race:

<script>var race = {};
race.model = "polls";
race.state = "US";
race.district = "";race.stateData = ["a lot of data"];
</script>

The data you're looking for is in race.stateData.forecasts.all.

Edit:

Turns out the data is available by itself here: http://projects.fivethirtyeight.com/2016-election-forecast/US.json, and you can swap out "US.json" for any state, e.g. "CA.json" for California.