{
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"import pickle as pkl\n",
"\n",
"predictions_this_year = {}\n",
"\n",
"with open('Source/Data/predictions_this_year.pkl', 'wb') as f:\n",
" pkl.dump(predictions_this_year, f)"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"key = '{\"type\": \"service_account\",\"project_id\": \"bmllc-398613\",\"private_key_id\": \"dae9f17eb79aee559b936bd88406ea399f729d9e\",\"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDhsB9x17UbxaT8\\nB/+2QziaZsdfeonp4ujU9v1yLLZfUS32mQGCanACklaMELrQ/KDaaJR9LW8xY7mH\\nKQ43I0K6wDq2OedR9HHVlP4JE1yvnJAoABMq46FVUlNF9dodyyf6Ajnnq28ahhTJ\\nLZcRk3KNgRVnBCxEHaUUPFZXXfxDI9Ptnvq7oHSuwNMHFbbla8Zo0x+tud1UWLOo\\nEbOHjdSYqEIcIdcT2DU3yVTig6C+X7aI10Nvlcq+NyXZCm/hx3JLyaEDCY3XTKAn\\nHao7zt5rOIp7Hf88hdeR3eQvSTgIwtzssPRkJmmGBpvBt/s/XcNvhWjwjTJ/Oq6q\\nr9FGTw5VAgMBAAECggEAAWDtCun8E5EFLVDzMUQp2q+ZX4OachD5G8vtHRRu122M\\nhVQb8UBV3NN+BIRZpSCAmbTygJfqykzHUQRhhNlfSqVqoRBWJxGs3FbOUnSJfWfM\\nbaIf0S7rc7T5Xepe4bhgTyOnrOWcMSJJNY1kvdkTuw+NzOpL8Zfow+iLx87YKqTQ\\nxpf33VUWdYwMi3ceakDcmJ32sxXs0xw2gPrmVBbz9pLBjLW68GNkMIYjk8OfN46d\\nSOMmzomVPhHvGma5khhyaUDV6NV6q1Ik/Ux6qjoaezqaVAmS3EiUghoxJTN7336s\\numouJz8sC/2PMg6vkZqEaY9mPYzsN2CeOHroV1eL5QKBgQD+iFb9ry8jpMSeAWyR\\nz9VUZ9sEqFKJi5rq1T87qABNVVrl4HoRdjcQPxplk9gtcdMvcXn1Vmuqb+qY4RBo\\nWYBLeX3ssknoBmGS78Ay6xq0J7sDz5qcrXIwQh3rQ/WpOFImy6zBcYBBdiT24uXx\\npWvTBqkQLJRDjZs6og/EyMLEuwKBgQDi/TY3eWVMy9hWlcGFZ+bmuFn0aIxCtYiH\\neXcKUWlCE7wfZhuG30iHSlM2kDHAIj0fLUDwFRQZR8qgynipbrAgZ8XznvD9w5vF\\nvSPv76cizcZIO3S+GBE6l4/anOi4Lhd4QbAQyHMGR43BQIWKYB/4dcU9g367KxFS\\ngWcJj0/QLwKBgQDB5BP4LXHIQiRwhH8y19IW+QITGzG8izcYehcwF3sbbdDPWd9C\\n2/14B8nQ5P2BKLsJ4fRYWlurupNHn/KCuuMLG2I8Y1f/QpUjfDS51PRDlhxU+9k4\\nTru0XTkzVVKWdEvIN9DCjvZ3Z0sjMpadLDjlyKYSpxLOHtnHoVpHufL8LwKBgQDC\\ni9euECPcgFH5U/07Q+RJFvQyYHDmtARCaL64XzJh6dww5Sjunezh17geadPaIv5T\\n/EtN+iLxz/BBg4eLYE0gWRD2TuGp/b9C6WsluDd9wvQQ8LSMQMBzgXdQHW/we8Ct\\n107583NyjF1Ypt5NzTlZkEbvBAbYkH8WQcZ4ERaNDQKBgBUczZgy5F+PLuH3O0Q3\\n6joILPuaBnJ0lRnEMeiq6rr91XZUyu600jHILfYIBQX23Z8j660pnbvNfjgMcqqa\\n7Lm99RA9lSGO1V9iW9hDU9irBKhEukpZds/hiW5e1SNn0AP+k+veEvRicDRVWSk0\\n7dS4tXLQR9w31YhZ5ONBNTQ9\\n-----END PRIVATE KEY-----\\n\",\"client_email\": \"huggingface@bmllc-398613.iam.gserviceaccount.com\",\"client_id\": \"103296969416633370732\", \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\"token_uri\": \"https://oauth2.googleapis.com/token\",\"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/huggingface%40bmllc-398613.iam.gserviceaccount.com\", \"universe_domain\": \"googleapis.com\"}'.replace('\\n','\\\\n')"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'{\"type\":\"service_account\",\"project_id\":\"bmllc-398613\",\"private_key_id\":\"dae9f17eb79aee559b936bd88406ea399f729d9e\",\"private_key\":\"-----BEGIN PRIVATE KEY-----\\\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDhsB9x17UbxaT8\\\\nB/+2QziaZsdfeonp4ujU9v1yLLZfUS32mQGCanACklaMELrQ/KDaaJR9LW8xY7mH\\\\nKQ43I0K6wDq2OedR9HHVlP4JE1yvnJAoABMq46FVUlNF9dodyyf6Ajnnq28ahhTJ\\\\nLZcRk3KNgRVnBCxEHaUUPFZXXfxDI9Ptnvq7oHSuwNMHFbbla8Zo0x+tud1UWLOo\\\\nEbOHjdSYqEIcIdcT2DU3yVTig6C+X7aI10Nvlcq+NyXZCm/hx3JLyaEDCY3XTKAn\\\\nHao7zt5rOIp7Hf88hdeR3eQvSTgIwtzssPRkJmmGBpvBt/s/XcNvhWjwjTJ/Oq6q\\\\nr9FGTw5VAgMBAAECggEAAWDtCun8E5EFLVDzMUQp2q+ZX4OachD5G8vtHRRu122M\\\\nhVQb8UBV3NN+BIRZpSCAmbTygJfqykzHUQRhhNlfSqVqoRBWJxGs3FbOUnSJfWfM\\\\nbaIf0S7rc7T5Xepe4bhgTyOnrOWcMSJJNY1kvdkTuw+NzOpL8Zfow+iLx87YKqTQ\\\\nxpf33VUWdYwMi3ceakDcmJ32sxXs0xw2gPrmVBbz9pLBjLW68GNkMIYjk8OfN46d\\\\nSOMmzomVPhHvGma5khhyaUDV6NV6q1Ik/Ux6qjoaezqaVAmS3EiUghoxJTN7336s\\\\numouJz8sC/2PMg6vkZqEaY9mPYzsN2CeOHroV1eL5QKBgQD+iFb9ry8jpMSeAWyR\\\\nz9VUZ9sEqFKJi5rq1T87qABNVVrl4HoRdjcQPxplk9gtcdMvcXn1Vmuqb+qY4RBo\\\\nWYBLeX3ssknoBmGS78Ay6xq0J7sDz5qcrXIwQh3rQ/WpOFImy6zBcYBBdiT24uXx\\\\npWvTBqkQLJRDjZs6og/EyMLEuwKBgQDi/TY3eWVMy9hWlcGFZ+bmuFn0aIxCtYiH\\\\neXcKUWlCE7wfZhuG30iHSlM2kDHAIj0fLUDwFRQZR8qgynipbrAgZ8XznvD9w5vF\\\\nvSPv76cizcZIO3S+GBE6l4/anOi4Lhd4QbAQyHMGR43BQIWKYB/4dcU9g367KxFS\\\\ngWcJj0/QLwKBgQDB5BP4LXHIQiRwhH8y19IW+QITGzG8izcYehcwF3sbbdDPWd9C\\\\n2/14B8nQ5P2BKLsJ4fRYWlurupNHn/KCuuMLG2I8Y1f/QpUjfDS51PRDlhxU+9k4\\\\nTru0XTkzVVKWdEvIN9DCjvZ3Z0sjMpadLDjlyKYSpxLOHtnHoVpHufL8LwKBgQDC\\\\ni9euECPcgFH5U/07Q+RJFvQyYHDmtARCaL64XzJh6dww5Sjunezh17geadPaIv5T\\\\n/EtN+iLxz/BBg4eLYE0gWRD2TuGp/b9C6WsluDd9wvQQ8LSMQMBzgXdQHW/we8Ct\\\\n107583NyjF1Ypt5NzTlZkEbvBAbYkH8WQcZ4ERaNDQKBgBUczZgy5F+PLuH3O0Q3\\\\n6joILPuaBnJ0lRnEMeiq6rr91XZUyu600jHILfYIBQX23Z8j660pnbvNfjgMcqqa\\\\n7Lm99RA9lSGO1V9iW9hDU9irBKhEukpZds/hiW5e1SNn0AP+k+veEvRicDRVWSk0\\\\n7dS4tXLQR9w31YhZ5ONBNTQ9\\\\n-----END PRIVATE KEY-----\\\\n\",\"client_email\":\"huggingface@bmllc-398613.iam.gserviceaccount.com\",\"client_id\":\"103296969416633370732\",\"auth_uri\":\"https://accounts.google.com/o/oauth2/auth\",\"token_uri\":\"https://oauth2.googleapis.com/token\",\"auth_provider_x509_cert_url\":\"https://www.googleapis.com/oauth2/v1/certs\",\"client_x509_cert_url\":\"https://www.googleapis.com/robot/v1/metadata/x509/huggingface%40bmllc-398613.iam.gserviceaccount.com\",\"universe_domain\":\"googleapis.com\"}'"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import json\n",
"\n",
"your_json = {\n",
" \"type\": \"service_account\",\n",
" \"project_id\": \"bmllc-398613\",\n",
" \"private_key_id\": \"dae9f17eb79aee559b936bd88406ea399f729d9e\",\n",
" \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDhsB9x17UbxaT8\\nB/+2QziaZsdfeonp4ujU9v1yLLZfUS32mQGCanACklaMELrQ/KDaaJR9LW8xY7mH\\nKQ43I0K6wDq2OedR9HHVlP4JE1yvnJAoABMq46FVUlNF9dodyyf6Ajnnq28ahhTJ\\nLZcRk3KNgRVnBCxEHaUUPFZXXfxDI9Ptnvq7oHSuwNMHFbbla8Zo0x+tud1UWLOo\\nEbOHjdSYqEIcIdcT2DU3yVTig6C+X7aI10Nvlcq+NyXZCm/hx3JLyaEDCY3XTKAn\\nHao7zt5rOIp7Hf88hdeR3eQvSTgIwtzssPRkJmmGBpvBt/s/XcNvhWjwjTJ/Oq6q\\nr9FGTw5VAgMBAAECggEAAWDtCun8E5EFLVDzMUQp2q+ZX4OachD5G8vtHRRu122M\\nhVQb8UBV3NN+BIRZpSCAmbTygJfqykzHUQRhhNlfSqVqoRBWJxGs3FbOUnSJfWfM\\nbaIf0S7rc7T5Xepe4bhgTyOnrOWcMSJJNY1kvdkTuw+NzOpL8Zfow+iLx87YKqTQ\\nxpf33VUWdYwMi3ceakDcmJ32sxXs0xw2gPrmVBbz9pLBjLW68GNkMIYjk8OfN46d\\nSOMmzomVPhHvGma5khhyaUDV6NV6q1Ik/Ux6qjoaezqaVAmS3EiUghoxJTN7336s\\numouJz8sC/2PMg6vkZqEaY9mPYzsN2CeOHroV1eL5QKBgQD+iFb9ry8jpMSeAWyR\\nz9VUZ9sEqFKJi5rq1T87qABNVVrl4HoRdjcQPxplk9gtcdMvcXn1Vmuqb+qY4RBo\\nWYBLeX3ssknoBmGS78Ay6xq0J7sDz5qcrXIwQh3rQ/WpOFImy6zBcYBBdiT24uXx\\npWvTBqkQLJRDjZs6og/EyMLEuwKBgQDi/TY3eWVMy9hWlcGFZ+bmuFn0aIxCtYiH\\neXcKUWlCE7wfZhuG30iHSlM2kDHAIj0fLUDwFRQZR8qgynipbrAgZ8XznvD9w5vF\\nvSPv76cizcZIO3S+GBE6l4/anOi4Lhd4QbAQyHMGR43BQIWKYB/4dcU9g367KxFS\\ngWcJj0/QLwKBgQDB5BP4LXHIQiRwhH8y19IW+QITGzG8izcYehcwF3sbbdDPWd9C\\n2/14B8nQ5P2BKLsJ4fRYWlurupNHn/KCuuMLG2I8Y1f/QpUjfDS51PRDlhxU+9k4\\nTru0XTkzVVKWdEvIN9DCjvZ3Z0sjMpadLDjlyKYSpxLOHtnHoVpHufL8LwKBgQDC\\ni9euECPcgFH5U/07Q+RJFvQyYHDmtARCaL64XzJh6dww5Sjunezh17geadPaIv5T\\n/EtN+iLxz/BBg4eLYE0gWRD2TuGp/b9C6WsluDd9wvQQ8LSMQMBzgXdQHW/we8Ct\\n107583NyjF1Ypt5NzTlZkEbvBAbYkH8WQcZ4ERaNDQKBgBUczZgy5F+PLuH3O0Q3\\n6joILPuaBnJ0lRnEMeiq6rr91XZUyu600jHILfYIBQX23Z8j660pnbvNfjgMcqqa\\n7Lm99RA9lSGO1V9iW9hDU9irBKhEukpZds/hiW5e1SNn0AP+k+veEvRicDRVWSk0\\n7dS4tXLQR9w31YhZ5ONBNTQ9\\n-----END PRIVATE KEY-----\\n\",\n",
" \"client_email\": \"huggingface@bmllc-398613.iam.gserviceaccount.com\",\n",
" \"client_id\": \"103296969416633370732\",\n",
" \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n",
" \"token_uri\": \"https://oauth2.googleapis.com/token\",\n",
" \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n",
" \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/huggingface%40bmllc-398613.iam.gserviceaccount.com\",\n",
" \"universe_domain\": \"googleapis.com\"\n",
"}\n",
"\n",
"one_line_json = json.dumps(your_json, separators=(',', ':')).replace(\"\\n\", \"\\\\n\")\n",
"one_line_json"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{'2023_1_CIN_CLE': {'Moneyline': {'Winner': 'NA',\n",
" 'Probabilities': ['N/A'],\n",
" 'rowIndex': 1},\n",
" 'Over/Under': {'Over/Under': 'N/A', 'Probability': ['N/A'], 'rowIndex': 1}}}"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import json\n",
"from google.cloud import storage\n",
"\n",
"# authenticate gcp\n",
"gcp_sa_key = json.loads(key)\n",
"client = storage.Client.from_service_account_info(gcp_sa_key)\n",
"bucket = client.get_bucket('bmllc-marci-data-bucket')\n",
"\n",
"# download\n",
"blob = bucket.blob('predictions_this_year.pkl')\n",
"buffer = blob.download_as_bytes()\n",
"predictions_this_year = pickle.loads(buffer)\n",
"\n",
"predictions_this_year"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" Moneyline | \n",
" Over/Under | \n",
"
\n",
" \n",
" \n",
" \n",
" 2023_1_CIN_CLE | \n",
" {'Winner': 'NA', 'Probabilities': ['N/A'], 'ro... | \n",
" {'Over/Under': 'N/A', 'Probability': ['N/A'], ... | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" Moneyline \\\n",
"2023_1_CIN_CLE {'Winner': 'NA', 'Probabilities': ['N/A'], 'ro... \n",
"\n",
" Over/Under \n",
"2023_1_CIN_CLE {'Over/Under': 'N/A', 'Probability': ['N/A'], ... "
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"pd.DataFrame(predictions_this_year).T"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [],
"source": [
"predictions_this_year = {}\n",
"buffer = pkl.dumps(predictions_this_year)\n",
"blob.upload_from_string(buffer, content_type='application/octet-stream')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"service_account_id = 'service-950327177777@gs-project-accounts.iam.gserviceaccount.com'"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.6666666666666666"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gpt_picks = ['Kansas City Chiefs',\n",
" 'Atlanta Falcons',\n",
" 'Baltimore Ravens',\n",
" 'Cleveland Browns',\n",
" 'Indianapolis Colts',\n",
" 'Tampa Bay Buccaneers',\n",
" 'New Orleans Saints',\n",
" 'San Francisco 49ers',\n",
" 'Washington Commanders',\n",
" 'Green Bay Packers',\n",
" 'Las Vegas Raiders',\n",
" 'Los Angeles Chargers',\n",
" 'New England Patriots',\n",
" 'Seattle Seahawks',\n",
" 'Dallas Cowboys']\n",
"\n",
"correct = [0,\n",
" 1,\n",
" 1,\n",
" 1,\n",
" 0,\n",
" 1,\n",
" 1,\n",
" 1,\n",
" 1,\n",
" 1,\n",
" 1,\n",
" 0,\n",
" 0,\n",
" 0,\n",
" 1]\n",
"\n",
"sum(correct)/len(correct)"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" game_id | \n",
" GP | \n",
" W | \n",
" L | \n",
" W_PCT | \n",
" TOP | \n",
" FGA | \n",
" FGM | \n",
" FG_PCT | \n",
" PassTD | \n",
" ... | \n",
" Sacks_Allowed.Away | \n",
" Penalties.Away | \n",
" FirstDowns.Away | \n",
" 3rdDownConverted.Away | \n",
" 3rdDownFailed.Away | \n",
" 3rdDownAllowed.Away | \n",
" 3rdDownDefended.Away | \n",
" PTS.Away | \n",
" PointDiff.Away | \n",
" game_date | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 2023_01_SF_PIT | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 11183.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" NaN | \n",
" 1.0 | \n",
" ... | \n",
" 3.0 | \n",
" 11.0 | \n",
" 21.0 | \n",
" 6.0 | \n",
" 7.0 | \n",
" 5.0 | \n",
" 10.0 | \n",
" 30.0 | \n",
" 23.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 1 | \n",
" 2023_01_MIA_LAC | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 24718.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 1.000000 | \n",
" 1.0 | \n",
" ... | \n",
" 0.0 | \n",
" 6.0 | \n",
" 29.0 | \n",
" 4.0 | \n",
" 5.0 | \n",
" 9.0 | \n",
" 6.0 | \n",
" 36.0 | \n",
" 2.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 2 | \n",
" 2023_01_CIN_CLE | \n",
" 1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 15262.0 | \n",
" 3.0 | \n",
" 3.0 | \n",
" 1.000000 | \n",
" 1.0 | \n",
" ... | \n",
" 2.0 | \n",
" 4.0 | \n",
" 6.0 | \n",
" 2.0 | \n",
" 13.0 | \n",
" 4.0 | \n",
" 10.0 | \n",
" 3.0 | \n",
" -21.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 3 | \n",
" 2023_01_GB_CHI | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 17119.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 1.000000 | \n",
" 1.0 | \n",
" ... | \n",
" 1.0 | \n",
" 9.0 | \n",
" 15.0 | \n",
" 9.0 | \n",
" 7.0 | \n",
" 3.0 | \n",
" 10.0 | \n",
" 38.0 | \n",
" 18.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 4 | \n",
" 2023_01_PHI_NE | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 17085.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" NaN | \n",
" 3.0 | \n",
" ... | \n",
" 3.0 | \n",
" 5.0 | \n",
" 17.0 | \n",
" 4.0 | \n",
" 9.0 | \n",
" 5.0 | \n",
" 10.0 | \n",
" 25.0 | \n",
" 5.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 5 | \n",
" 2023_01_DAL_NYG | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 23666.0 | \n",
" 2.0 | \n",
" 0.0 | \n",
" 0.000000 | \n",
" 0.0 | \n",
" ... | \n",
" 0.0 | \n",
" 5.0 | \n",
" 18.0 | \n",
" 6.0 | \n",
" 7.0 | \n",
" 5.0 | \n",
" 11.0 | \n",
" 40.0 | \n",
" 40.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 6 | \n",
" 2023_01_DET_KC | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 15329.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 1.000000 | \n",
" 2.0 | \n",
" ... | \n",
" 1.0 | \n",
" 4.0 | \n",
" 19.0 | \n",
" 5.0 | \n",
" 10.0 | \n",
" 5.0 | \n",
" 9.0 | \n",
" 21.0 | \n",
" 1.0 | \n",
" 2023-09-07 | \n",
"
\n",
" \n",
" 7 | \n",
" 2023_01_ARI_WAS | \n",
" 1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 14896.0 | \n",
" 2.0 | \n",
" 2.0 | \n",
" 1.000000 | \n",
" 1.0 | \n",
" ... | \n",
" 3.0 | \n",
" 9.0 | \n",
" 13.0 | \n",
" 4.0 | \n",
" 10.0 | \n",
" 4.0 | \n",
" 8.0 | \n",
" 16.0 | \n",
" -4.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 8 | \n",
" 2023_01_TB_MIN | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 19010.0 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 1.000000 | \n",
" 2.0 | \n",
" ... | \n",
" 1.0 | \n",
" 3.0 | \n",
" 16.0 | \n",
" 6.0 | \n",
" 11.0 | \n",
" 6.0 | \n",
" 8.0 | \n",
" 20.0 | \n",
" 3.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 9 | \n",
" 2023_01_HOU_BAL | \n",
" 1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 15653.0 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 1.000000 | \n",
" 0.0 | \n",
" ... | \n",
" 5.0 | \n",
" 9.0 | \n",
" 17.0 | \n",
" 7.0 | \n",
" 11.0 | \n",
" 8.0 | \n",
" 7.0 | \n",
" 9.0 | \n",
" -16.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 10 | \n",
" 2023_01_LA_SEA | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 13979.0 | \n",
" 3.0 | \n",
" 2.0 | \n",
" 0.666667 | \n",
" 1.0 | \n",
" ... | \n",
" 0.0 | \n",
" 7.0 | \n",
" 27.0 | \n",
" 11.0 | \n",
" 6.0 | \n",
" 2.0 | \n",
" 7.0 | \n",
" 30.0 | \n",
" 17.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 11 | \n",
" 2023_01_TEN_NO | \n",
" 1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 14954.0 | \n",
" 3.0 | \n",
" 3.0 | \n",
" 1.000000 | \n",
" 1.0 | \n",
" ... | \n",
" 3.0 | \n",
" 6.0 | \n",
" 16.0 | \n",
" 2.0 | \n",
" 10.0 | \n",
" 7.0 | \n",
" 9.0 | \n",
" 15.0 | \n",
" -1.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 12 | \n",
" 2023_01_JAX_IND | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 13879.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" NaN | \n",
" 1.0 | \n",
" ... | \n",
" 2.0 | \n",
" 4.0 | \n",
" 20.0 | \n",
" 3.0 | \n",
" 9.0 | \n",
" 2.0 | \n",
" 10.0 | \n",
" 31.0 | \n",
" 10.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 13 | \n",
" 2023_01_CAR_ATL | \n",
" 1.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 10398.0 | \n",
" 1.0 | \n",
" 1.0 | \n",
" 1.000000 | \n",
" 1.0 | \n",
" ... | \n",
" 2.0 | \n",
" 9.0 | \n",
" 20.0 | \n",
" 5.0 | \n",
" 9.0 | \n",
" 2.0 | \n",
" 8.0 | \n",
" 10.0 | \n",
" -14.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
" 14 | \n",
" 2023_01_LV_DEN | \n",
" 1.0 | \n",
" 0.0 | \n",
" 1.0 | \n",
" 0.0 | \n",
" 29267.0 | \n",
" 2.0 | \n",
" 1.0 | \n",
" 0.500000 | \n",
" 2.0 | \n",
" ... | \n",
" 0.0 | \n",
" 10.0 | \n",
" 20.0 | \n",
" 5.0 | \n",
" 6.0 | \n",
" 5.0 | \n",
" 6.0 | \n",
" 17.0 | \n",
" 1.0 | \n",
" 2023-09-10 | \n",
"
\n",
" \n",
"
\n",
"
15 rows × 65 columns
\n",
"
"
],
"text/plain": [
" game_id GP W L W_PCT TOP FGA FGM FG_PCT \\\n",
"0 2023_01_SF_PIT 1.0 0.0 1.0 0.0 11183.0 0.0 0.0 NaN \n",
"1 2023_01_MIA_LAC 1.0 0.0 1.0 0.0 24718.0 2.0 2.0 1.000000 \n",
"2 2023_01_CIN_CLE 1.0 1.0 0.0 1.0 15262.0 3.0 3.0 1.000000 \n",
"3 2023_01_GB_CHI 1.0 0.0 1.0 0.0 17119.0 2.0 2.0 1.000000 \n",
"4 2023_01_PHI_NE 1.0 0.0 1.0 0.0 17085.0 0.0 0.0 NaN \n",
"5 2023_01_DAL_NYG 1.0 0.0 1.0 0.0 23666.0 2.0 0.0 0.000000 \n",
"6 2023_01_DET_KC 1.0 0.0 1.0 0.0 15329.0 2.0 2.0 1.000000 \n",
"7 2023_01_ARI_WAS 1.0 1.0 0.0 1.0 14896.0 2.0 2.0 1.000000 \n",
"8 2023_01_TB_MIN 1.0 0.0 1.0 0.0 19010.0 1.0 1.0 1.000000 \n",
"9 2023_01_HOU_BAL 1.0 1.0 0.0 1.0 15653.0 1.0 1.0 1.000000 \n",
"10 2023_01_LA_SEA 1.0 0.0 1.0 0.0 13979.0 3.0 2.0 0.666667 \n",
"11 2023_01_TEN_NO 1.0 1.0 0.0 1.0 14954.0 3.0 3.0 1.000000 \n",
"12 2023_01_JAX_IND 1.0 0.0 1.0 0.0 13879.0 0.0 0.0 NaN \n",
"13 2023_01_CAR_ATL 1.0 1.0 0.0 1.0 10398.0 1.0 1.0 1.000000 \n",
"14 2023_01_LV_DEN 1.0 0.0 1.0 0.0 29267.0 2.0 1.0 0.500000 \n",
"\n",
" PassTD ... Sacks_Allowed.Away Penalties.Away FirstDowns.Away \\\n",
"0 1.0 ... 3.0 11.0 21.0 \n",
"1 1.0 ... 0.0 6.0 29.0 \n",
"2 1.0 ... 2.0 4.0 6.0 \n",
"3 1.0 ... 1.0 9.0 15.0 \n",
"4 3.0 ... 3.0 5.0 17.0 \n",
"5 0.0 ... 0.0 5.0 18.0 \n",
"6 2.0 ... 1.0 4.0 19.0 \n",
"7 1.0 ... 3.0 9.0 13.0 \n",
"8 2.0 ... 1.0 3.0 16.0 \n",
"9 0.0 ... 5.0 9.0 17.0 \n",
"10 1.0 ... 0.0 7.0 27.0 \n",
"11 1.0 ... 3.0 6.0 16.0 \n",
"12 1.0 ... 2.0 4.0 20.0 \n",
"13 1.0 ... 2.0 9.0 20.0 \n",
"14 2.0 ... 0.0 10.0 20.0 \n",
"\n",
" 3rdDownConverted.Away 3rdDownFailed.Away 3rdDownAllowed.Away \\\n",
"0 6.0 7.0 5.0 \n",
"1 4.0 5.0 9.0 \n",
"2 2.0 13.0 4.0 \n",
"3 9.0 7.0 3.0 \n",
"4 4.0 9.0 5.0 \n",
"5 6.0 7.0 5.0 \n",
"6 5.0 10.0 5.0 \n",
"7 4.0 10.0 4.0 \n",
"8 6.0 11.0 6.0 \n",
"9 7.0 11.0 8.0 \n",
"10 11.0 6.0 2.0 \n",
"11 2.0 10.0 7.0 \n",
"12 3.0 9.0 2.0 \n",
"13 5.0 9.0 2.0 \n",
"14 5.0 6.0 5.0 \n",
"\n",
" 3rdDownDefended.Away PTS.Away PointDiff.Away game_date \n",
"0 10.0 30.0 23.0 2023-09-10 \n",
"1 6.0 36.0 2.0 2023-09-10 \n",
"2 10.0 3.0 -21.0 2023-09-10 \n",
"3 10.0 38.0 18.0 2023-09-10 \n",
"4 10.0 25.0 5.0 2023-09-10 \n",
"5 11.0 40.0 40.0 2023-09-10 \n",
"6 9.0 21.0 1.0 2023-09-07 \n",
"7 8.0 16.0 -4.0 2023-09-10 \n",
"8 8.0 20.0 3.0 2023-09-10 \n",
"9 7.0 9.0 -16.0 2023-09-10 \n",
"10 7.0 30.0 17.0 2023-09-10 \n",
"11 9.0 15.0 -1.0 2023-09-10 \n",
"12 10.0 31.0 10.0 2023-09-10 \n",
"13 8.0 10.0 -14.0 2023-09-10 \n",
"14 6.0 17.0 1.0 2023-09-10 \n",
"\n",
"[15 rows x 65 columns]"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"scores = pd.read_csv('Source/Data/gbg_this_year.csv')\n",
"scores"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"\n",
"headers = {\n",
"'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',\n",
"'Accept-Encoding': 'gzip, deflate',\n",
"'Accept-Language': 'en-US,en;q=0.9',\n",
"'Cache-Control': 'max-age=0',\n",
"'Connection': 'keep-alive',\n",
"'Dnt': '1',\n",
"'Upgrade-Insecure-Requests': '1',\n",
"'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36'\n",
"}\n",
"\n",
"url = 'https://www.bettingpros.com/nfl/matchups/'\n",
"resp = requests.get(url, headers=headers)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"BettingPros\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"
\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
"\n",
""
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from bs4 import BeautifulSoup\n",
"soup = BeautifulSoup(resp.text, 'html.parser')\n",
"soup"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"ename": "ModuleNotFoundError",
"evalue": "No module named 'nfl_data_py'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\Brayden\\OneDrive - stern.nyu.edu\\Brayden Moore LLC\\Python\\Projects\\MARCI 3.0\\MARCI-NFL-Betting\\Notebook.ipynb Cell 12\u001b[0m line \u001b[0;36m1\n\u001b[1;32m----> 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mSource\u001b[39;00m\u001b[39m.\u001b[39;00m\u001b[39mBuild\u001b[39;00m \u001b[39mimport\u001b[39;00m build\n\u001b[0;32m 3\u001b[0m pbp \u001b[39m=\u001b[39m build\u001b[39m.\u001b[39mget_pbp_data([\u001b[39m2023\u001b[39m])\n\u001b[0;32m 4\u001b[0m pbp \u001b[39m=\u001b[39m pbp\u001b[39m.\u001b[39mdrop_duplicates(subset\u001b[39m=\u001b[39m\u001b[39m'\u001b[39m\u001b[39mgame_id\u001b[39m\u001b[39m'\u001b[39m)\n",
"File \u001b[1;32mc:\\Users\\Brayden\\OneDrive - stern.nyu.edu\\Brayden Moore LLC\\Python\\Projects\\MARCI 3.0\\MARCI-NFL-Betting\\Source\\Build\\build.py:1\u001b[0m\n\u001b[1;32m----> 1\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mnfl_data_py\u001b[39;00m \u001b[39mimport\u001b[39;00m nfl_data_py \u001b[39mas\u001b[39;00m nfl\n\u001b[0;32m 2\u001b[0m \u001b[39mfrom\u001b[39;00m \u001b[39mtqdm\u001b[39;00m \u001b[39mimport\u001b[39;00m tqdm\n\u001b[0;32m 3\u001b[0m \u001b[39mimport\u001b[39;00m \u001b[39mnumpy\u001b[39;00m \u001b[39mas\u001b[39;00m \u001b[39mnp\u001b[39;00m\n",
"\u001b[1;31mModuleNotFoundError\u001b[0m: No module named 'nfl_data_py'"
]
}
],
"source": [
"from Source.Build import build\n",
"\n",
"pbp = build.get_pbp_data([2023])\n",
"pbp = pbp.drop_duplicates(subset='game_id')"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" game_id | \n",
" total | \n",
" winner | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 2023_01_ARI_WAS | \n",
" 36 | \n",
" Washington Commanders | \n",
"
\n",
" \n",
" 175 | \n",
" 2023_01_CAR_ATL | \n",
" 34 | \n",
" Atlanta Falcons | \n",
"
\n",
" \n",
" 344 | \n",
" 2023_01_CIN_CLE | \n",
" 27 | \n",
" Cleveland Browns | \n",
"
\n",
" \n",
" 517 | \n",
" 2023_01_DAL_NYG | \n",
" 40 | \n",
" Dallas Cowboys | \n",
"
\n",
" \n",
" 683 | \n",
" 2023_01_DET_KC | \n",
" 41 | \n",
" Detroit Lions | \n",
"
\n",
" \n",
" 862 | \n",
" 2023_01_GB_CHI | \n",
" 58 | \n",
" Green Bay Packers | \n",
"
\n",
" \n",
" 1042 | \n",
" 2023_01_HOU_BAL | \n",
" 34 | \n",
" Baltimore Ravens | \n",
"
\n",
" \n",
" 1227 | \n",
" 2023_01_JAX_IND | \n",
" 52 | \n",
" Jacksonville Jaguars | \n",
"
\n",
" \n",
" 1409 | \n",
" 2023_01_LA_SEA | \n",
" 43 | \n",
" Los Angeles Rams | \n",
"
\n",
" \n",
" 1586 | \n",
" 2023_01_LV_DEN | \n",
" 33 | \n",
" Las Vegas Raiders | \n",
"
\n",
" \n",
" 1744 | \n",
" 2023_01_MIA_LAC | \n",
" 70 | \n",
" Miami Dolphins | \n",
"
\n",
" \n",
" 1935 | \n",
" 2023_01_PHI_NE | \n",
" 45 | \n",
" Philadelphia Eagles | \n",
"
\n",
" \n",
" 2126 | \n",
" 2023_01_SF_PIT | \n",
" 37 | \n",
" San Francisco 49ers | \n",
"
\n",
" \n",
" 2302 | \n",
" 2023_01_TB_MIN | \n",
" 37 | \n",
" Tampa Bay Buccaneers | \n",
"
\n",
" \n",
" 2477 | \n",
" 2023_01_TEN_NO | \n",
" 31 | \n",
" New Orleans Saints | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" game_id total winner\n",
"0 2023_01_ARI_WAS 36 Washington Commanders\n",
"175 2023_01_CAR_ATL 34 Atlanta Falcons\n",
"344 2023_01_CIN_CLE 27 Cleveland Browns\n",
"517 2023_01_DAL_NYG 40 Dallas Cowboys\n",
"683 2023_01_DET_KC 41 Detroit Lions\n",
"862 2023_01_GB_CHI 58 Green Bay Packers\n",
"1042 2023_01_HOU_BAL 34 Baltimore Ravens\n",
"1227 2023_01_JAX_IND 52 Jacksonville Jaguars\n",
"1409 2023_01_LA_SEA 43 Los Angeles Rams\n",
"1586 2023_01_LV_DEN 33 Las Vegas Raiders\n",
"1744 2023_01_MIA_LAC 70 Miami Dolphins\n",
"1935 2023_01_PHI_NE 45 Philadelphia Eagles\n",
"2126 2023_01_SF_PIT 37 San Francisco 49ers\n",
"2302 2023_01_TB_MIN 37 Tampa Bay Buccaneers\n",
"2477 2023_01_TEN_NO 31 New Orleans Saints"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import os\n",
"import pickle as pkl\n",
"\n",
"# get team abbreviations\n",
"file_path = 'Source/Pickles/team_name_to_abbreviation.pkl'\n",
"with open(file_path, 'rb') as f:\n",
" team_name_to_abbreviation = pkl.load(f)\n",
"\n",
"file_path = 'Source/Pickles/team_abbreviation_to_name.pkl'\n",
"with open(file_path, 'rb') as f:\n",
" team_abbreviation_to_name = pkl.load(f)\n",
"\n",
"pbp[['season','week','away','home']] = pbp['game_id'].str.split('_', expand=True)\n",
"games = pbp[['game_id','away_score','home_score','season','week','away','home']]\n",
"games[['away_score','home_score','season','week']] = games[['away_score','home_score','season','week']].astype(int)\n",
"\n",
"games['away_team'] = games['away'].map(team_abbreviation_to_name)\n",
"games['home_team'] = games['home'].map(team_abbreviation_to_name)\n",
"\n",
"games['total'] = games['away_score'] + games['home_score']\n",
"games['winner'] = [a if a_s>h_s else h if h_s>a_s else 'Tie' for a,h,a_s,h_s in games[['away_team','home_team','away_score','home_score']].values]\n",
"results = games[['game_id','total','winner']]"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'games' is not defined",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32mc:\\Users\\Brayden\\OneDrive - stern.nyu.edu\\Brayden Moore LLC\\Python\\Projects\\MARCI 3.0\\MARCI-NFL-Betting\\Notebook.ipynb Cell 14\u001b[0m line \u001b[0;36m1\n\u001b[1;32m----> 1\u001b[0m results \u001b[39m=\u001b[39m games[[\u001b[39m'\u001b[39m\u001b[39mgame_id\u001b[39m\u001b[39m'\u001b[39m,\u001b[39m'\u001b[39m\u001b[39mtotal\u001b[39m\u001b[39m'\u001b[39m,\u001b[39m'\u001b[39m\u001b[39mwinner\u001b[39m\u001b[39m'\u001b[39m]]\n",
"\u001b[1;31mNameError\u001b[0m: name 'games' is not defined"
]
}
],
"source": [
"results = games[['game_id','total','winner']]"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\Brayden\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python311\\site-packages\\dateutil\\parser\\_parser.py:1207: UnknownTimezoneWarning: tzname EST identified but not understood. Pass `tzinfos` argument in order to correctly return a timezone-aware datetime. In a future version, this will raise an exception.\n",
" warnings.warn(\"tzname {tzname} identified but not understood. \"\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" game_id | \n",
" Away Team | \n",
" Home Team | \n",
" Date | \n",
" winner | \n",
" total | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 2023_01_DET_KC | \n",
" Detroit Lions | \n",
" Kansas City Chiefs | \n",
" Thursday 9/7 08:20 | \n",
" Detroit Lions | \n",
" 41 | \n",
"
\n",
" \n",
" 1 | \n",
" 2023_01_CIN_CLE | \n",
" Cincinnati Bengals | \n",
" Cleveland Browns | \n",
" Sunday 9/10 01:00 | \n",
" Cleveland Browns | \n",
" 27 | \n",
"
\n",
" \n",
" 2 | \n",
" 2023_01_JAX_IND | \n",
" Jacksonville Jaguars | \n",
" Indianapolis Colts | \n",
" Sunday 9/10 01:00 | \n",
" Jacksonville Jaguars | \n",
" 52 | \n",
"
\n",
" \n",
" 3 | \n",
" 2023_01_TB_MIN | \n",
" Tampa Bay Buccaneers | \n",
" Minnesota Vikings | \n",
" Sunday 9/10 01:00 | \n",
" Tampa Bay Buccaneers | \n",
" 37 | \n",
"
\n",
" \n",
" 4 | \n",
" 2023_01_TEN_NO | \n",
" Tennessee Titans | \n",
" New Orleans Saints | \n",
" Sunday 9/10 01:00 | \n",
" New Orleans Saints | \n",
" 31 | \n",
"
\n",
" \n",
" 5 | \n",
" 2023_01_CAR_ATL | \n",
" Carolina Panthers | \n",
" Atlanta Falcons | \n",
" Sunday 9/10 01:00 | \n",
" Atlanta Falcons | \n",
" 34 | \n",
"
\n",
" \n",
" 6 | \n",
" 2023_01_HOU_BAL | \n",
" Houston Texans | \n",
" Baltimore Ravens | \n",
" Sunday 9/10 01:00 | \n",
" Baltimore Ravens | \n",
" 34 | \n",
"
\n",
" \n",
" 7 | \n",
" 2023_01_SF_PIT | \n",
" San Francisco 49ers | \n",
" Pittsburgh Steelers | \n",
" Sunday 9/10 01:00 | \n",
" San Francisco 49ers | \n",
" 37 | \n",
"
\n",
" \n",
" 8 | \n",
" 2023_01_ARI_WAS | \n",
" Arizona Cardinals | \n",
" Washington Commanders | \n",
" Sunday 9/10 01:00 | \n",
" Washington Commanders | \n",
" 36 | \n",
"
\n",
" \n",
" 9 | \n",
" 2023_01_GB_CHI | \n",
" Green Bay Packers | \n",
" Chicago Bears | \n",
" Sunday 9/10 04:25 | \n",
" Green Bay Packers | \n",
" 58 | \n",
"
\n",
" \n",
" 10 | \n",
" 2023_01_MIA_LAC | \n",
" Miami Dolphins | \n",
" Los Angeles Chargers | \n",
" Sunday 9/10 04:25 | \n",
" Miami Dolphins | \n",
" 70 | \n",
"
\n",
" \n",
" 11 | \n",
" 2023_01_LV_DEN | \n",
" Las Vegas Raiders | \n",
" Denver Broncos | \n",
" Sunday 9/10 04:25 | \n",
" Las Vegas Raiders | \n",
" 33 | \n",
"
\n",
" \n",
" 12 | \n",
" 2023_01_PHI_NE | \n",
" Philadelphia Eagles | \n",
" New England Patriots | \n",
" Sunday 9/10 04:25 | \n",
" Philadelphia Eagles | \n",
" 45 | \n",
"
\n",
" \n",
" 13 | \n",
" 2023_01_DAL_NYG | \n",
" Dallas Cowboys | \n",
" New York Giants | \n",
" Sunday 9/10 08:20 | \n",
" Dallas Cowboys | \n",
" 40 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" game_id Away Team Home Team \\\n",
"0 2023_01_DET_KC Detroit Lions Kansas City Chiefs \n",
"1 2023_01_CIN_CLE Cincinnati Bengals Cleveland Browns \n",
"2 2023_01_JAX_IND Jacksonville Jaguars Indianapolis Colts \n",
"3 2023_01_TB_MIN Tampa Bay Buccaneers Minnesota Vikings \n",
"4 2023_01_TEN_NO Tennessee Titans New Orleans Saints \n",
"5 2023_01_CAR_ATL Carolina Panthers Atlanta Falcons \n",
"6 2023_01_HOU_BAL Houston Texans Baltimore Ravens \n",
"7 2023_01_SF_PIT San Francisco 49ers Pittsburgh Steelers \n",
"8 2023_01_ARI_WAS Arizona Cardinals Washington Commanders \n",
"9 2023_01_GB_CHI Green Bay Packers Chicago Bears \n",
"10 2023_01_MIA_LAC Miami Dolphins Los Angeles Chargers \n",
"11 2023_01_LV_DEN Las Vegas Raiders Denver Broncos \n",
"12 2023_01_PHI_NE Philadelphia Eagles New England Patriots \n",
"13 2023_01_DAL_NYG Dallas Cowboys New York Giants \n",
"\n",
" Date winner total \n",
"0 Thursday 9/7 08:20 Detroit Lions 41 \n",
"1 Sunday 9/10 01:00 Cleveland Browns 27 \n",
"2 Sunday 9/10 01:00 Jacksonville Jaguars 52 \n",
"3 Sunday 9/10 01:00 Tampa Bay Buccaneers 37 \n",
"4 Sunday 9/10 01:00 New Orleans Saints 31 \n",
"5 Sunday 9/10 01:00 Atlanta Falcons 34 \n",
"6 Sunday 9/10 01:00 Baltimore Ravens 34 \n",
"7 Sunday 9/10 01:00 San Francisco 49ers 37 \n",
"8 Sunday 9/10 01:00 Washington Commanders 36 \n",
"9 Sunday 9/10 04:25 Green Bay Packers 58 \n",
"10 Sunday 9/10 04:25 Miami Dolphins 70 \n",
"11 Sunday 9/10 04:25 Las Vegas Raiders 33 \n",
"12 Sunday 9/10 04:25 Philadelphia Eagles 45 \n",
"13 Sunday 9/10 08:20 Dallas Cowboys 40 "
]
},
"execution_count": 1,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from Source.Predict import predict\n",
"\n",
"predict.get_games(week=1,season=2023)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"from Source.Predict import predict\n",
"predictions = []\n",
"for _,row in games.iterrows():\n",
" prediction = predict.predict(row['home'],row['away'],row['season'],row['week']+1, 45)\n",
" predictions.append(prediction)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" 0 | \n",
" 1 | \n",
" 2 | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 2023_2_ARI_WAS | \n",
" {'Winner': ['WAS'], 'Probabilities': [0.719565... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.633... | \n",
"
\n",
" \n",
" 1 | \n",
" 2023_2_CAR_ATL | \n",
" {'Winner': ['ATL'], 'Probabilities': [0.596400... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.876... | \n",
"
\n",
" \n",
" 2 | \n",
" 2023_2_CIN_CLE | \n",
" {'Winner': ['CLE'], 'Probabilities': [0.769957... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.654... | \n",
"
\n",
" \n",
" 3 | \n",
" 2023_2_DAL_NYG | \n",
" {'Winner': ['DAL'], 'Probabilities': [0.548317... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.653... | \n",
"
\n",
" \n",
" 4 | \n",
" 2023_2_DET_KC | \n",
" {'Winner': ['DET'], 'Probabilities': [0.518149... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.566... | \n",
"
\n",
" \n",
" 5 | \n",
" 2023_2_GB_CHI | \n",
" {'Winner': ['GB'], 'Probabilities': [0.5585460... | \n",
" {'Over/Under': ['Under'], 'Probability': [0.88... | \n",
"
\n",
" \n",
" 6 | \n",
" 2023_2_HOU_BAL | \n",
" {'Winner': ['BAL'], 'Probabilities': [0.782784... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.603... | \n",
"
\n",
" \n",
" 7 | \n",
" 2023_2_JAX_IND | \n",
" {'Winner': ['JAX'], 'Probabilities': [0.595993... | \n",
" {'Over/Under': ['Under'], 'Probability': [0.50... | \n",
"
\n",
" \n",
" 8 | \n",
" 2023_2_LA_SEA | \n",
" {'Winner': ['LA'], 'Probabilities': [0.5388965... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.638... | \n",
"
\n",
" \n",
" 9 | \n",
" 2023_2_LV_DEN | \n",
" {'Winner': ['DEN'], 'Probabilities': [0.605623... | \n",
" {'Over/Under': ['Under'], 'Probability': [0.70... | \n",
"
\n",
" \n",
" 10 | \n",
" 2023_2_MIA_LAC | \n",
" {'Winner': ['LAC'], 'Probabilities': [0.599673... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.522... | \n",
"
\n",
" \n",
" 11 | \n",
" 2023_2_PHI_NE | \n",
" {'Winner': ['NE'], 'Probabilities': [0.5209159... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.537... | \n",
"
\n",
" \n",
" 12 | \n",
" 2023_2_SF_PIT | \n",
" {'Winner': ['SF'], 'Probabilities': [0.7199300... | \n",
" {'Over/Under': ['Under'], 'Probability': [0.60... | \n",
"
\n",
" \n",
" 13 | \n",
" 2023_2_TB_MIN | \n",
" {'Winner': ['TB'], 'Probabilities': [0.5235458... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.543... | \n",
"
\n",
" \n",
" 14 | \n",
" 2023_2_TEN_NO | \n",
" {'Winner': ['NO'], 'Probabilities': [0.6887440... | \n",
" {'Over/Under': ['Over'], 'Probability': [0.742... | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" 0 1 \\\n",
"0 2023_2_ARI_WAS {'Winner': ['WAS'], 'Probabilities': [0.719565... \n",
"1 2023_2_CAR_ATL {'Winner': ['ATL'], 'Probabilities': [0.596400... \n",
"2 2023_2_CIN_CLE {'Winner': ['CLE'], 'Probabilities': [0.769957... \n",
"3 2023_2_DAL_NYG {'Winner': ['DAL'], 'Probabilities': [0.548317... \n",
"4 2023_2_DET_KC {'Winner': ['DET'], 'Probabilities': [0.518149... \n",
"5 2023_2_GB_CHI {'Winner': ['GB'], 'Probabilities': [0.5585460... \n",
"6 2023_2_HOU_BAL {'Winner': ['BAL'], 'Probabilities': [0.782784... \n",
"7 2023_2_JAX_IND {'Winner': ['JAX'], 'Probabilities': [0.595993... \n",
"8 2023_2_LA_SEA {'Winner': ['LA'], 'Probabilities': [0.5388965... \n",
"9 2023_2_LV_DEN {'Winner': ['DEN'], 'Probabilities': [0.605623... \n",
"10 2023_2_MIA_LAC {'Winner': ['LAC'], 'Probabilities': [0.599673... \n",
"11 2023_2_PHI_NE {'Winner': ['NE'], 'Probabilities': [0.5209159... \n",
"12 2023_2_SF_PIT {'Winner': ['SF'], 'Probabilities': [0.7199300... \n",
"13 2023_2_TB_MIN {'Winner': ['TB'], 'Probabilities': [0.5235458... \n",
"14 2023_2_TEN_NO {'Winner': ['NO'], 'Probabilities': [0.6887440... \n",
"\n",
" 2 \n",
"0 {'Over/Under': ['Over'], 'Probability': [0.633... \n",
"1 {'Over/Under': ['Over'], 'Probability': [0.876... \n",
"2 {'Over/Under': ['Over'], 'Probability': [0.654... \n",
"3 {'Over/Under': ['Over'], 'Probability': [0.653... \n",
"4 {'Over/Under': ['Over'], 'Probability': [0.566... \n",
"5 {'Over/Under': ['Under'], 'Probability': [0.88... \n",
"6 {'Over/Under': ['Over'], 'Probability': [0.603... \n",
"7 {'Over/Under': ['Under'], 'Probability': [0.50... \n",
"8 {'Over/Under': ['Over'], 'Probability': [0.638... \n",
"9 {'Over/Under': ['Under'], 'Probability': [0.70... \n",
"10 {'Over/Under': ['Over'], 'Probability': [0.522... \n",
"11 {'Over/Under': ['Over'], 'Probability': [0.537... \n",
"12 {'Over/Under': ['Under'], 'Probability': [0.60... \n",
"13 {'Over/Under': ['Over'], 'Probability': [0.543... \n",
"14 {'Over/Under': ['Over'], 'Probability': [0.742... "
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"import pandas as pd\n",
"pd.DataFrame(predictions)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.5"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}