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.
You have a DataFrame called customer_data
with the following structure:
Customer_ID | Age | Country | Category | |
---|---|---|---|---|
0 | 1 | 25 | USA | A |
1 | 2 | 40 | Canada | B |
2 | 3 | 32 | USA | C |
3 | 4 | 50 | Canada | A |
4 | 5 | 28 | USA | B |
Consider a DataFrame df
that contains information about students and their test scores in different subjects.
The DataFrame has the following structure:
Student | Subject | Score | |
---|---|---|---|
0 | John | Math | 80 |
1 | Jane | Science | 90 |
2 | John | Science | 95 |
3 | Jane | Math | 85 |
4 | John | Math | 75 |
You want to group the DataFrame by the Student
column and calculate the average score for each student. However, you also want to include students who have not appeared in all subjects.
You have a dataset containing information about students' test scores in different subjects.
The dataset has the following structure:
Student_ID | Subject | Score | |
---|---|---|---|
0 | 1 | Math | 85 |
1 | 2 | Science | 92 |
2 | 3 | Math | 78 |
3 | 4 | English | 88 |
4 | 5 | Science | 90 |
Your task is to create a crosstab that displays the count of students who scored above 80
in each subject. The crosstab should have the subjects as columns and the count of students as values.
Consider a DataFrame df
that contains information about students, their test scores, and the subject they belong to.
The DataFrame has the following structure:
Student | Subject | Score | Grade | |
---|---|---|---|---|
0 | John | Math | 80 | A |
1 | Jane | Science | 90 | A |
2 | John | Science | 95 | A |
3 | Jane | Math | 85 | B |
4 | John | Math | 75 | B |
You want to create a pivot table that shows the average score for each student based on their subject, and you want the columns of the pivot table to represent the different grades. Additionally, you want to include all students and subjects in the resulting pivot table, even if there are missing values.