Question: Write the Python code to find the average number of hours studying each week that Senior students in Data Science DISCOVERY have and store that


Write the Python code to find the average number of hours studying each week that Senior students in Data Science DISCOVERY have and store that number in average: Dataset This problem uses the "Hello" dataset survey that was generated on the first day of class. This dataset has been loaded into df for you already and contains the following variables (columns): - Name (string), user-supplied first name, ex: "Wade", "Karle", ... - Major (string), intended major, ex: "Political Science", "Psychology", ... - School Year (string), current academic class, one of: "Freshman", "Sophomore", "Junior", "Senior", or "0ther" - Hours Studying (number), number of hours spent studying each week, ex: 3,1, - Siblings (number), number of siblings, ex: 0,2, - Hours of Sleep (number), number of hours sleeping each week, ex: 7,8, - Shoes Owned (number), number of pairs of shoes owned, ex: 4,20, - ...and other variables, not used in this problem... Variables The setup code gives the following variables: Your code snippet should define the following variables: Pandas Cheat Sheet Open the pandas cheat sheet in a new tab user_code.py import pandas as pd \# The dataset is already loaded as a DataFrame the variable ' df '. df_Senior =df[df.School_Year == "Senior" ] average =df Senior.groupby (["Hour Studying""Number"]).agg.("mean").reset.index()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
