{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework 3 - Chapter 8" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "- Due Date: Monday, February 9th no later than 11:59 p.m.\n", "- Partner Information: Learning to collaborate with others is an important skill and\n", "one that employers value. This assignment requires you to partner with a classmate and submit \n", "one solution for the two of you.\n", "- Submission Instructions: Upload your solution, entitled \n", "**YourFirstName-YourLastName-PartnerFirstName-PartnerLastName-Homework3.ipynb** to the \n", "Canvas Homework 3 Dropbox. Note: only one person needs to submit a solution. If you and your partner \n", "both submit a solution, the submission that will be graded is the one from the partner whose last name comes \n", "alphabetically first.\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": {}, "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": [ "The Super Bowl is almost upon us. Working with data collected from the Fall 2024 regular season, you will utilize\n", "your Data Science skills to make predictions about future games, even if you have no football expertise." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 1 - 3 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 7 entries in the augmented table." ] }, { "cell_type": "code", "execution_count": null, "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 the 2025 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 7 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": null, "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 3a - 2 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": null, "metadata": {}, "outputs": [], "source": [ "# Place answer here." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 3b - 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:** " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Question 4 - 2 Points" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Discover something insightful with the provided data set. \n", "Explain what you have done and why it is insightful." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Place code here" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "**Explanation -**" ] } ], "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.14.2" } }, "nbformat": 4, "nbformat_minor": 4 }