Question
# Attributes for both student-mat.csv (Math course) and student-por.csv (Portuguese language course) datasets: 1 school - student's school (binary: GP - Gabriel Pereira or MS
# Attributes for both student-mat.csv (Math course) and student-por.csv (Portuguese language course) datasets: 1 school - student's school (binary: "GP" - Gabriel Pereira or "MS" - Mousinho da Silveira) 2 sex - student's sex (binary: "F" - female or "M" - male) 3 age - student's age (numeric: from 15 to 22) 4 address - student's home address type (binary: "U" - urban or "R" - rural) 5 famsize - family size (binary: "LE3" - less or equal to 3 or "GT3" - greater than 3) 6 Pstatus - parent's cohabitation status (binary: "T" - living together or "A" - apart) 7 Medu - mother's education (numeric: 0 - none, 1 - primary education (4th grade), 2 5th to 9th grade, 3 secondary education or 4 higher education) 8 Fedu - father's education (numeric: 0 - none, 1 - primary education (4th grade), 2 5th to 9th grade, 3 secondary education or 4 higher education) 9 Mjob - mother's job (nominal: "teacher", "health" care related, civil "services" (e.g. administrative or police), "at_home" or "other") 10 Fjob - father's job (nominal: "teacher", "health" care related, civil "services" (e.g. administrative or police), "at_home" or "other") 11 reason - reason to choose this school (nominal: close to "home", school "reputation", "course" preference or "other") 12 guardian - student's guardian (nominal: "mother", "father" or "other") 13 traveltime - home to school travel time (numeric: 1 - 1 hour) 14 studytime - weekly study time (numeric: 1 - 10 hours) 15 failures - number of past class failures (numeric: n if 1
# these grades are related with the course subject, Math or Portuguese: 31 G1 - first period grade (numeric: from 0 to 20) 31 G2 - second period grade (numeric: from 0 to 20) 32 G3 - final grade (numeric: from 0 to 20, output target)
Additional note: there are several (382) students that belong to both datasets . These students can be identified by searching for identical attributes that characterize each student, as shown in the annexed R file.
In this problem, we explore some OLAP operations 1 with pandas 2, a famous data analysis tools for Python. We analyze a dataset of student performance on Mathematics (file: student-mat.csv), which is a part of the Student Performance Data Set 3. In the dataset, each record (row) is a student, each attribute (column) has different meaning with explanation in file student.txt. (1) (4 points) Load the data. How many attributes does the dataset have? How many students (records) does the dataset have? Hint: You need to set an appropriate delimiter sep when using pandas.read_csv(). (2) (4 points) What is the mean of all students' final grades (G3)? What is the median? Hint: Here is a tutorial for calculating summary statistics. (3) (8 points) Slicing and dicing. (a) How many students are 16 years old? What is the mean of their final grade? (b) How many students have age from 16 to 18 (both inclusive) and study time more than 5 hours a week simultaneously? What is the mean of their final grade? Hint: Check Boolean indexing to see how to select data and write conditions and logical operations. Also remember to check the definition of studytime attributes. (4) (8 points) Pivot table. The pivot table API in pandas can help us pivot and visualize two or more dimensions of the data cube. Draw a pivot table with two dimensions: study time and travel time, and show the mean of final grades. It is not necessary to convert the index (e.g., traveltime=1) to actual meaning (e.g.,Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started