Question: I need help with this code, I am getting the error message listed below the code. Step 2 : Scatterplot and Correlation for the Total
I need help with this code, I am getting the error message listed below the code.
Step : Scatterplot and Correlation for the Total Number of Wins and Average Points Scored
Your coach expects teams to win more games in a regular season if they have a high average number of points compared to their opponents. This is because the chances of winning are higher if a team scores high in its games. Therefore, it is expected that the total number of wins and the average points scored are correlated. Calculate the Pearson correlation coefficient and its Pvalue. Make the following edits to the code block below:
Replace DATAFRAMENAME?? with the name of the dataframe used in this project. See Step for the name of dataframe used in this project.
Replace POINTS?? with the name of the variable for average points scored in a regular season. See the table included in the Project Three instructions above to pick the variable name. Enclose this variable in single quotes. For example, if the variable name is var then replace POINTS?? with 'var
Replace WINS?? with the name of the variable for the total number of wins in a regular season. Remember to enclose the variable in single quotes. See the table included in the Project Three instructions above to pick the variable name. Enclose this variable in single quotes. For example, if the variable name is var then replace WINS?? with 'var
The code block below will print a scatterplot of the total number of wins against the average points scored in a regular season.
After you are done with your edits, click the block of code below and hit the Run button above.
In :
import scipy.stats as st
# TODO: make your edits here
pltplotnbawinsdata.csvavgpts 'nbawinsdata.csvtotalwins'o
plttitleTotal Number of Wins by Average Points Scored', fontsize
pltxlabelAverage Points Scored'
pltylabelTotal Number of Wins'
pltshow
# TODO: make your edits here
correlationcoefficient, pvalue stpearsonrnbawinsdata.csvavgpts 'nbawinsdata.csvtotalwins'
printCorrelation between Average Points Scored and the Total Number of Wins
printPearson Correlation Coefficient roundcorrelationcoefficient,
printPvalue roundpvalue,
TypeError Traceback most recent call last
in
# TODO: make your edits here
pltplotnbawinsdata.csvavgpts 'nbawinsdata.csvtotalwins'o
plttitleTotal Number of Wins by Average Points Scored', fontsize
TypeError: string indices must be integersPlease fast the process
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
