{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework 3 - Chapter 8" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Due Date: Monday, September 15th no later than 11:59 p.m.\n", "- Partner Information: Complete this assignment individually.\n", "- Submission Instructions: Upload your solution, entitled **YourFirstName-YourLastName-Homework3.ipynb** to the \n", "Canvas Homework 3 Dropbox.\n", "- Deadline Reminder: Once the submission deadline passes, Canvas will no longer accept your submission and you will no longer be able to earn credit. \n", "Thus, if you are not able to fully complete the assignment, submit whatever you have before the deadline so that partial credit can be earned." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Starting Code" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from datascience import *\n", "import numpy as np" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Download the file [nfl_2024.csv](https://www.cs.montana.edu/paxton/classes/fall-2025/intro-ds/homeworks/hw3/nfl_2024.csv)\n", "into the same directory as this Jupyter notebook." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "jupyter": { "source_hidden": true } }, "outputs": [], "source": [ "# Place the csv file in the same directory as your solution\n", "season = Table().read_table(\"nfl_2024.csv\")\n", "season" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Football Season is back, and you are already trying to guess who is going to win the Super Bowl. Using data collected from last year's regular season, you want to put your Data Science skills to work in order to make the best guess you can (setting aside any actual football expertise, of course)." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 1 - 4 Points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Knowing that *defense wins championships*, you want to determine which games the winning team held their opponent below the average (mean) points scored by losing teams across the season. \n", "\n", "Create a function that returns **True** if the points scored by the losing team (**Loser Points**) is below the mean of that column \n", "and **False** otherwise. Apply this function to the table, adding a new column entitled **Loser Below Average?** with these values. \n", "Display the first 8 entries in the augmented table." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 2 - 2 Points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's use the column that was just created to make a prediction for this year's Super Bowl. Using Python, create a table with two columns: (1) the name of a football team - call this *Team* and (2) the number of times that when that team won, the losing team's point total was below average - call this *Big Wins*. Display the first 8 entries in this 2-column table in descending order by *Big Wins*. **Hint** - If done correctly, the sixth entry in the table will have 7 Big Wins." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Assume that that top two teams in the table you produced for Question 2 will play in the Super Bowl." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 3 - 3 Points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Point differential is another important statistic when it comes to determining success in the Super Bowl. Create a pivot table where the columns are the two teams that Question 2 predicts will play in the Super Bowl and the rows are the values of the **Loser\n", "Below Average** column. Only consider games that the two Super Bowl contenders won. Each entry in the table should be the mean point differential - calculated by subtracting the points scored by the losing team from the points scored by the winning team. Display the pivot table. The mean point differentials should be formatted to display 2 digits\n", "to the right of the decimal." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 4 - 1 Point" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Using information from the above pivot table, explain carefully which of the two teams\n", "you would predict to win the Super Bowl." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Your answer:** " ] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "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.13.7" } }, "nbformat": 4, "nbformat_minor": 4 }