Data Wrangling with Pandas

# Practice PivotTables and Crosstab with Student Grades data

In this lab activity, we will be working with the Student Grade dataset, exploring and analyzing the data using pivot tables and crosstabs. We will examine factors that influence student grades and discover patterns and trends. By utilizing these powerful tools, we will summarize and calculate statistics based on different variables. This will enable us to gain insights into student performance and understand how various factors contribute to their grades. Through hands-on exercises, you will learn how to effectively analyze and interpret data using pivot tables and crosstabs. By the end of this lab, you will have a solid understanding of these techniques and be able to apply them to other datasets as well. Get ready to enhance your data analysis skills and uncover valuable insights into student performance!
Project Created by

## Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

### Calculate the average G1 grade by moother job (`Mjob`).

Store the resulting dataframe in the variable `pivot_table_g1_by_Mjob`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average G2 grade by school and sex.

Store the resulting dataframe in the variable `pivot_table_avg_g2_by_school_sex`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the maximum G3 grade by age.

Store the resulting dataframe in the variable `pivot_table_max_g3_by_age`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average health (`health`) by family size (`famsize`) and fill missing values with 0.

Store the resulting dataframe in the variable `pivot_table_avg_g1_by_famsize`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average G2 grade by school and include row and column totals.

Store the resulting dataframe in the variable `pivot_table_avg_g2_by_school`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average free time (`freetime`) grade by school, and include sex and age as columns (fill missing values with 0).

Store the resulting dataframe in the variable `pivot_table_avg_freetime_by_school_sex_age`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average absences by school and address.

Store the resulting dataframe in the variable `pivot_table_avg_absences_by_school_address`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average freetime and number of absences by school.

Store the resulting dataframe in the variable `pivot_table_avg_freetime_absences_by_school`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the sum of absences by guardian.

Store the resulting dataframe in the variable `pivot_table_sum_absences_by_guardian`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average G1 grade by school and fill missing values with 'N/A'.

Store the resulting dataframe in the variable `pivot_table_avg_g1_by_school`.

Your result should look similar to this dataframe:

codevalidated

### Count the number of students by guardian and age and include sex as column.

Store the resulting dataframe in the variable `cross_tab_students_by_guardian_age_sex`.

Your result should look similar to this dataframe:

codevalidated

### Count the number of students by school, and include sex and age as columns and include row and column totals.

Store the resulting dataframe in the variable `cross_tab_students_by_school_sex_age`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the average travel time (`traveltime`) by address, sex, and age.

Store the resulting dataframe in the variable `crosstab_avg_traveltime_by_school_sex_age`.

Your result should look similar to this dataframe:

codevalidated

### Count the number of students who have participated in extracurricular activities by school and sex.

Store the resulting dataframe in the variable `crosstab_activities_by_school_sex`.

Your result should look similar to this dataframe:

codevalidated

### Calculate the percentage of students who have internet access, categorized by school and sex.

Store the resulting dataframe in the variable `crosstab_internet_access_by_school_sex`.

Your result should look similar to this dataframe:

Project Created by

#### Mohamed Rawash

This project is part of

## Data Wrangling with Pandas

Explore other projects