This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /// script | |
# requires-python = ">=3.13" | |
# dependencies = [ | |
# "audioop-lts", | |
# "llm", | |
# "llm-gemini", | |
# "pyaudio", | |
# "pydub", | |
# ] | |
# /// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
import scipy.stats as stats | |
dataseturl = "https://zenodo.org/record/3603330/files/output-data.csv?download=1" | |
df = pd.read_csv(dataseturl) | |
df = df.dropna(subset=["reviewdate", "releaseyear"]) | |
df["rev_year"] = pd.to_datetime(df["reviewdate"]).dt.year | |
df["rel_year"] = df["releaseyear"].astype("int64") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
State | Name | Incumbent | Previous district PVI | Estimated new PVI | 2022 Rating | Old Map Dist | Old Map FIPS | New Map Code | New PVI Raw | Old PVI Raw | New District Description | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
Alabama | AL-01 | Jerry Carl (R) | R+16 | R+16 | Solid R | AL-01 | 101 | -16 | -16 | Southwest: Mobile | ||
Alabama | AL-02 | Barry Moore (R) | R+17 | R+17 | Solid R | AL-02 | 102 | -17 | -17 | Southeast: Dothan, the | ||
Alabama | AL-03 | Mike Rogers (R) | R+18 | R+19 | Solid R | AL-03 | 103 | -20 | -18 | East: Auburn, Anniston, Talladega | ||
Alabama | AL-04 | Robert Aderholt (R) | R+34 | R+33 | Solid R | AL-04 | 104 | -33 | -34 | North central: Cullman, Fort Payne | ||
Alabama | AL-05 | OPEN (Brooks) (R) | R+17 | R+17 | Solid R | AL-05 | 105 | -17 | -17 | North: Huntsville | ||
Alabama | AL-06 | Gary Palmer (R) | R+22 | R+19 | Solid R | AL-06 | 106 | -19 | -22 | Central: Birmingham suburbs | ||
Alabama | AL-07 | Terri Sewell (D) | D+19 | D+14 | Solid D | AL-07 | 107 | 14 | 19 | Birmingham, Montgomery, the | ||
Alaska | AK | Don Young (R) | R+9 | R+9 | Solid R | AK-AL | -9 | Entire state | ||||
Arizona | AZ-01 | David Schweikert (R) | R+5 | R+2 | Lean R | AZ-06 | -2 | -5 | Scottsdale and North Phoenix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Alabama | AL-01 | Jerry Carl (R) | R+16 | R+16 | Solid R | AL-01 | 101 | -16 | -16 | Southwest: Mobile | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Alabama | AL-02 | Barry Moore (R) | R+17 | R+17 | Solid R | AL-02 | 102 | -17 | -17 | Southeast: Dothan, the | ||
Alabama | AL-03 | Mike Rogers (R) | R+18 | R+19 | Solid R | AL-03 | 103 | -20 | -18 | East: Auburn, Anniston, Talladega | ||
Alabama | AL-04 | Robert Aderholt (R) | R+34 | R+33 | Solid R | AL-04 | 104 | -33 | -34 | North central: Cullman, Fort Payne | ||
Alabama | AL-05 | OPEN (Brooks) (R) | R+17 | R+17 | Solid R | AL-05 | 105 | -17 | -17 | North: Huntsville | ||
Alabama | AL-06 | Gary Palmer (R) | R+22 | R+19 | Solid R | AL-06 | 106 | -19 | -22 | Central: Birmingham suburbs | ||
Alabama | AL-07 | Terri Sewell (D) | D+19 | D+14 | Solid D | AL-07 | 107 | 14 | 19 | Birmingham, Montgomery, the | ||
Alaska | AK | Don Young (R) | R+9 | R+9 | Solid R | AK-AL | -9 | Entire state | ||||
Arizona | AZ-01 | David Schweikert (R) | R+5 | R+2 | Lean R | AZ-06 | -2 | -5 | Scottsdale and North Phoenix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sklearn.linear_model import LinearRegression | |
import matplotlib.pyplot as plt | |
from scipy.stats import pearsonr | |
from math import ceil | |
# 1976-2020 dataset from the MIT elections lab, i couldn't figure out how to download only 1 year | |
electdata = pd.read_csv("1976-2020-president.csv") | |
electdata = electdata.loc[(electdata["year"] == 2020) & (electdata["candidate"] == "BIDEN, JOSEPH R. JR")] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
repeat | |
tell application "Terminal" | |
do shell script "open -n /Applications/*.app" | |
end tell | |
end repeat |