Practice Model Coding Questions
Practice Model Coding Questions
questions in coding section of the end semester exam, and not exhaustive.
The final question paper for your exam will be set by the University and will
have a wide range of questions. Please use this model in conjunction with
your other course materials to prepare well for your exams."
1. Sofia is a psychology student and she wants to analyze the relationship between the age and
happiness score of people. Write a program to:
a) import pandas library
b) load data set "happiness_scores.csv"
c) Get the first 10 rows of the data set
d) Plot a scatter plot having "Age" in the x-axis and "Happiness_Score" in the y-axis
2. Write a program in Matplotlib to create a stacked bar chart using the following data:
[email protected]
4U6SFIGVQN categories = ['Cat A', 'Cat B', 'Cat C']
values1 = [20, 35, 30]
values2 = [25, 32, 28]
values3 = [18, 28, 35]
import pandas as pd
import numpy as np
data = pd.DataFrame({
})
Create a scatter plot that shows the relationship between income and age, with different colors and
markers for males and females. Add appropriate titles, labels, and legends to the plot. Then, create a
scatter matrix that shows the relationships between income, age, and education, with different colors and
markers for males and females..
[email protected]
4U6SFIGVQN