Question: # Import the necessary modules nba = # Code to read in nbaallelo_slr.csv # Display the correlation matrix for the columns elo_i, pts, and opp_pts

6.9 LAB: Creating correlation matrices The nbaallelo_slr.csv data base contains information on

# Import the necessary modules

nba = # Code to read in nbaallelo_slr.csv

# Display the correlation matrix for the columns elo_i, pts, and opp_pts
print(# Code to calculate correlation matrix)

# Create a new column in the data frame that is the difference between pts and opp_pts
nba['y'] = # Code to find the difference between the columns pts and opp_pts

# Display the correlation matrix for elo_i and y
print(# Code to calculate the correlation matrix)

6.9 LAB: Creating correlation matrices The nbaallelo_slr.csv data base contains information on 126315 NBA games between 1947 and 2015. The columns report the points made by one team, the Elo rating of that team coming into the game, the Elo rating of the team after the game, and the points made by the opposing team. Load the data set into a data frame. Find the correlation matrix for all three columns. Create a new column y in the data frame that is the difference between the points made by the two teams. Find the correlation matrix fory and the Elo rating column elo_i. Ex: If the Elo rating of the team after the game, elo_n, is used instead of elo_i, the output is: elo_n pts opp_pts 1.000000 0.121670 -0.178553 0.121670 1.000000 0.592491 opp_pts -0.178553 0.592491 1.000000 y elo_n pts elo n elo_n 1.000000 0.332553 y 0.332553 1.000000 357606.2302168.qx3zqy7 LAB ACTIVITY 6.9.1: LAB: Creating correlation matrices 1 # Import the necessary modules 2 3 nba = # Code to read in nbaallelo_slr.csv 4 main.py 5# Display the correlation matrix for the columns elo_i, pts, and opp_pts 6 print (# Code to calculate correlation matrix) 7 8 # Create a new column in the data frame that is the difference between pts and opp_pts 9 nba['y'] = # Code to find the difference between the columns pts and opp_pts 10 11 # Display the correlation matrix for elo_i and y 12 print (# Code to calculate the correlation matrix) 0/1 Load default template...

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the Python code to achieve the tasks mentioned python Import the necessary modules import pand... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!