38.6k views
3 votes
The management of your team wants you to run descriptive statistics on the relative skill of your team from 2013-2015. In this project, you will use the variable 'elo_n' to represent the relative skill of the teams. Calculate descriptive statistics including the mean, median, variance, and standard deviation for the relative skill of your team.

Make the following edits to the code block below:
1. Replace ??MEAN_FUNCTION?? with the name of Python function that calculates the mean
2. Replace ??MEDIAN FUNCTION?? with the name of Python function that calculates the median
3. Replace ?? VAR FUNCTION?? with the name of Python function that calculates the variance
4. Replace ??STD FUNCTION?? with the name of Python function that calculates the standard deviation

print("Your Team's Relative skill in 2013 to 2015")
print("________________________________")

#.............TODO: make your edits here ................
mean = your_team_df['elo_n'].??MEAN FUNCTION?? ()
median = your_team_df ['elo n'].??MEDIAN FUNCTION?? ()
variance = your_team_df ['elo n'].?? TVAR FUNCTION?? ()
stdeviation = your_team_df ['elo n'].??STD_FUNCTION??

print('Mean =' , round(mean, 2))
print('Median =' , round(median, 2))
print('variance =' , round(variance, 2))
print('Standard deviation =' , round(stdeviation, 2))

User Sumit Rane
by
5.3k points

2 Answers

3 votes

Final answer:

To calculate the descriptive statistics for the relative skill of your team from 2013-2015, you can use the numpy library in Python. Replace the placeholders with the correct numpy functions to calculate the mean, median, variance, and standard deviation. The modified code will print the calculated statistics.

Step-by-step explanation:

The Python functions you need to calculate the descriptive statistics for the relative skill of your team from 2013-2015 are as follows:

  1. Mean: You can use the numpy.mean() function to calculate the mean. Replace ??MEAN_FUNCTION?? with numpy.mean(your_team_df['elo_n']).
  2. Median: You can use the numpy.median() function to calculate the median. Replace ??MEDIAN FUNCTION?? with numpy.median(your_team_df['elo_n']).
  3. Variance: You can use the numpy.var() function to calculate the variance. Replace ?? VAR FUNCTION?? with numpy.var(your_team_df['elo_n']).
  4. Standard Deviation: You can use the numpy.std() function to calculate the standard deviation. Replace ??STD FUNCTION?? with numpy.std(your_team_df['elo_n']).

Here is the modified code:

import numpy as np

print("Your Team's Relative skill in 2013 to 2015")
print("________________________________")
mean = np.mean(your_team_df['elo_n'])
median = np.median(your_team_df['elo_n'])
variance = np.var(your_team_df['elo_n'])
stdeviation = np.std(your_team_df['elo_n'])
print('Mean =', round(mean, 2))
print('Median =', round(median, 2))
print('Variance =', round(variance, 2))
print('Standard deviation =', round(stdeviation, 2))
User Ronay
by
5.2k points
5 votes

Final answer:

To generate descriptive statistics in Python, use the 'mean', 'median', 'var', and 'std' functions from the pandas library to calculate the mean, median, variance, and standard deviation, respectively.

Step-by-step explanation:

To calculate descriptive statistics for the relative skill of your team using Python, you can make the following edits to the code that was provided:

  • Replace ??MEAN_FUNCTION?? with 'mean'
  • Replace ??MEDIAN_FUNCTION?? with 'median'
  • Replace ??VAR_FUNCTION?? with 'var'
  • Replace ??STD_FUNCTION?? with 'std'

Here is the corrected code block with the appropriate functions from the pandas library:

print("Your Team's Relative skill in 2013 to 2015")
print("________________________________")
#.............TODO: make your edits here ................
mean = your_team_df['elo_n'].mean()
median = your_team_df['elo_n'].median()
variance = your_team_df['elo_n'].var()
stdeviation = your_team_df['elo_n'].std()
print('Mean =', round(mean, 2))
print('Median =', round(median, 2))
print('Variance =', round(variance, 2))
print('Standard deviation =', round(stdeviation, 2))
User Reptilicus
by
6.1k points