1. Follow the FDR to implement a function called add_average. This function must be placed inside the file Txxx_MI_load_data.py below load_data. Function Description: • The function will add the average of the student's grades (G1, G2 and G3) as an additional attribute to the dictionary. It takes one input parameter (regardless of the key): (1) a dictionary • It returns the updated dictionary Sample output (assuming school as key): with the average grade.

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
Please answer this question in 10 mins I will upvote your answer. Python programming for the question:-
1. Follow the FDR to implement a function called add_average. This function must be
placed inside the file Txxx_M1_load_data.py below load_data.
Function Description:
• The function will add the average of the student's grades (G1, G2 and G3) as an
additional attribute to the dictionary.
• It takes one input parameter (regardless of the key): (1) a dictionary
•
It returns the dictionary updated
Sample output (assuming school as key):
with the average grade.
Transcribed Image Text:1. Follow the FDR to implement a function called add_average. This function must be placed inside the file Txxx_M1_load_data.py below load_data. Function Description: • The function will add the average of the student's grades (G1, G2 and G3) as an additional attribute to the dictionary. • It takes one input parameter (regardless of the key): (1) a dictionary • It returns the dictionary updated Sample output (assuming school as key): with the average grade.
{ 'GP'
'MB'
.. }
:
:
[ {'Age': 18, 'StudyTime': 1.8, 'Failures': 0, 'Health': 3,
'Absences': 6, 'G1': 5, 'G2': 6, 'G3¹: 6, 'G_Avg': 5.67 },
{another element),
],
...
[ {'Age': 16, 'StudyTime': 2.6,
'Failures': 0, 'Health':
'Absences': 12, 'G1¹: 10, 'G2¹: 12, 'G3': 12, 'G_Avg': 11.33 },
{another element},
],
3,
2. Test your function. For this lab, you can just call your function to ensure that the data is
loaded correctly. For testing purposes, use student-mat.csv. Ensure that the function calls
are added to the end of the main script.
Transcribed Image Text:{ 'GP' 'MB' .. } : : [ {'Age': 18, 'StudyTime': 1.8, 'Failures': 0, 'Health': 3, 'Absences': 6, 'G1': 5, 'G2': 6, 'G3¹: 6, 'G_Avg': 5.67 }, {another element), ], ... [ {'Age': 16, 'StudyTime': 2.6, 'Failures': 0, 'Health': 'Absences': 12, 'G1¹: 10, 'G2¹: 12, 'G3': 12, 'G_Avg': 11.33 }, {another element}, ], 3, 2. Test your function. For this lab, you can just call your function to ensure that the data is loaded correctly. For testing purposes, use student-mat.csv. Ensure that the function calls are added to the end of the main script.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Functions
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
  • SEE MORE 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