Step 7 - Descriptive Statistics - Points Scored By Your Time in Away Games The management also wants you to run descriptive statistics on the points scored by your team in games played at opponent's venue (Away) in 2013-2015. They want you to analyze measures of central tendency (e.g. mean, median) and measures of spread (e.g. standard deviation) in explaining if the team is doing better in Home games compared to Away games. Calculate descriptive statistics including the mean, median, variance, and standard deviation for points scored by your team played in opponent's venue (Away). Make the following edits to the code block below: You are to write this code block yourself. Use Step 6 to help you write this code block. Here is some information that will help you write this code block. 1. Since you are calculating statistics for games played at opponent's venue, game_location variable should be set to 'A'. 2. Functions for all statistics are the same as those in step 6. 3. Your statistics should be rounded to two decimal places. Write your code in the code block section below. After you are done, click this block of code and hit the Run button above. Reach out to your instructor if you need more help with this step.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The Python code for step 7 is needed. Step 6 has been attached for data reference 

**Step 7 - Descriptive Statistics - Points Scored By Your Team in Away Games**

The management also wants you to run descriptive statistics on the points scored by your team in games played at opponent's venue (Away) in 2013-2015. They want you to analyze measures of central tendency (e.g., mean, median) and measures of spread (e.g., standard deviation) in explaining if the team is doing better in Home games compared to Away games. Calculate descriptive statistics including the mean, median, variance, and standard deviation for points scored by your team played in opponent’s venue (Away). Make the following edits to the code block below:

**You are to write this code block yourself.**

Use Step 6 to help you write this code block. Here is some information that will help you write this code block.

1. **Since you are calculating statistics for games played at opponent’s venue, game_location variable should be set to 'A'.**
2. **Functions for all statistics are the same as those in step 6.**
3. **Your statistics should be rounded to two decimal places.**

Write your code in the code block below. After you are done, click this block of code and hit the Run button above. Reach out to your instructor if you need more help with this step.
Transcribed Image Text:**Step 7 - Descriptive Statistics - Points Scored By Your Team in Away Games** The management also wants you to run descriptive statistics on the points scored by your team in games played at opponent's venue (Away) in 2013-2015. They want you to analyze measures of central tendency (e.g., mean, median) and measures of spread (e.g., standard deviation) in explaining if the team is doing better in Home games compared to Away games. Calculate descriptive statistics including the mean, median, variance, and standard deviation for points scored by your team played in opponent’s venue (Away). Make the following edits to the code block below: **You are to write this code block yourself.** Use Step 6 to help you write this code block. Here is some information that will help you write this code block. 1. **Since you are calculating statistics for games played at opponent’s venue, game_location variable should be set to 'A'.** 2. **Functions for all statistics are the same as those in step 6.** 3. **Your statistics should be rounded to two decimal places.** Write your code in the code block below. After you are done, click this block of code and hit the Run button above. Reach out to your instructor if you need more help with this step.
**Step 6: Descriptive Statistics: Points Scored By Your Team in Home Games**

The management of your team wants you to run descriptive statistics on the points scored by your team in the games played at your team's venue in 2013-2015. Calculate descriptive statistics including the mean, median, variance, and standard deviation for points scored by your team played at Home. 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.

After you are done with your edits, click the block of code below and hit the **Run** button above.

```python
print("Points Scored by Your Team in Home Games (2013 to 2015)")
print("-------------------------------------------------------")

your_team_home_df = your_team_df[your_team_df['game_location']=='H'].copy()

# ---- TODO: make your edits here ----
mean = your_team_home_df['pts'].mean()
median = your_team_home_df['pts'].median()
variance = your_team_home_df['pts'].var()
stdeviation = your_team_home_df['pts'].std()
print('Mean =', round(mean,2))
print('Median =', round(median,2))
print('Variance =', round(variance,2))
print('Standard Deviation =', round(stdeviation,2))
```

**Output:**

```
Points Scored by Your Team in Home Games (2013 to 2015)
-------------------------------------------------------
Mean = 99.06
Median = 99.0
Variance = 121.68
Standard Deviation = 11.03
```

This script calculates the mean, median, variance, and standard deviation of the points scored by your team in home games from 2013 to 2015 using the Pandas library in Python.
Transcribed Image Text:**Step 6: Descriptive Statistics: Points Scored By Your Team in Home Games** The management of your team wants you to run descriptive statistics on the points scored by your team in the games played at your team's venue in 2013-2015. Calculate descriptive statistics including the mean, median, variance, and standard deviation for points scored by your team played at Home. 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. After you are done with your edits, click the block of code below and hit the **Run** button above. ```python print("Points Scored by Your Team in Home Games (2013 to 2015)") print("-------------------------------------------------------") your_team_home_df = your_team_df[your_team_df['game_location']=='H'].copy() # ---- TODO: make your edits here ---- mean = your_team_home_df['pts'].mean() median = your_team_home_df['pts'].median() variance = your_team_home_df['pts'].var() stdeviation = your_team_home_df['pts'].std() print('Mean =', round(mean,2)) print('Median =', round(median,2)) print('Variance =', round(variance,2)) print('Standard Deviation =', round(stdeviation,2)) ``` **Output:** ``` Points Scored by Your Team in Home Games (2013 to 2015) ------------------------------------------------------- Mean = 99.06 Median = 99.0 Variance = 121.68 Standard Deviation = 11.03 ``` This script calculates the mean, median, variance, and standard deviation of the points scored by your team in home games from 2013 to 2015 using the Pandas library in Python.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Decision Table
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education