realize where the result was coming from. Add polls

This commit is contained in:
NunoSempere 2024-04-13 21:24:17 -04:00
parent 1d6ec55612
commit e6374cbc82
8 changed files with 9584 additions and 2 deletions

19
README.md Normal file
View File

@ -0,0 +1,19 @@
Electoral votes/election
Year | Republican electoral college votes
2000 | 271
2004 | 286
2008 | 173
2012 | 206
2016 | 304
2020 | 232
Year | Democrat electoral college votes
2000 | 266
2004 | 251
2008 | 365
2012 | 332
2016 | 227
2020 | 232
Ok, so because Obama really trounced the opposition, it won by more than the Republicans won, which means that the baserates approach didn't really work.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
State,Winning Party State,Party
Alabama,R Alabama,R
Alaska,R Alaska,R
Arizona,R Arizona,R

1 State Winning Party Party
2 Alabama R
3 Alaska R
4 Arizona R

View File

@ -1,3 +1,4 @@
State,Party
Alabama,R Alabama,R
Alaska,R Alaska,R
Arizona,D Arizona,D

1 Alabama State R Party
1 State Party
2 Alabama Alabama R R
3 Alaska Alaska R R
4 Arizona Arizona D D

View File

@ -1,3 +1,8 @@
https://www.archives.gov/electoral-college/2000
https://www.archives.gov/electoral-college/2004
https://www.archives.gov/electoral-college/2008
https://www.archives.gov/electoral-college/2012
https://www.archives.gov/electoral-college/2016
https://www.archives.gov/electoral-college/2020 https://www.archives.gov/electoral-college/2020
https://www.archives.gov/electoral-college/[year] https://www.archives.gov/electoral-college/[year]

View File

@ -31,7 +31,8 @@ func readStates() ([]State, error) {
var states map[string]State = make(map[string]State) var states map[string]State = make(map[string]State)
/* Electoral college votes for the 2024 election*/ /* Electoral college votes for the 2024 election*/
votes_file, err := os.Open("data/electoral-college-votes-2010-census.csv") votes_file, err := os.Open("data/electoral-college-votes.csv")
// votes_file, err := os.Open("data/electoral-college-votes-2010-census.csv")
if err != nil { if err != nil {
return nil, fmt.Errorf("error opening the votes file: %v", err) return nil, fmt.Errorf("error opening the votes file: %v", err)
} }

6
makefile Normal file
View File

@ -0,0 +1,6 @@
polls:
mkdir -p data/polls
# cd data/polls && wget https://projects.fivethirtyeight.com/polls/data/president_polls.csv
cat data/polls/president_polls.csv | awk -F, 'NR==1 {print; next} $$13 != ""' > data/polls/president_polls_state.csv
# cd data/polls && awk -F, 'NR == 1 || $13 != ""' president_polls.csv > president_polls_state.csv