Data Science Quiz
Check what you learned in this data science tutorial. Choose an answer for each question to see if you are right.
Before You Start
Many questions use this DataFrame:
Example
import pandas as pd
df = pd.DataFrame({
"name": ["Ali", "Ayesha", "Bilal", "Sana"],
"city": ["Karachi", "Lahore", "Karachi", "Lahore"],
"marks": [70, 88, 64, 90],
})
print(df.groupby("city")["marks"].mean())city Karachi 67.0 Lahore 89.0 Name: marks, dtype: float64
If you miss a question, go back to the matching chapter:
| Topic | Chapter |
|---|---|
| DataFrames, loc and iloc | Pandas Basics |
| Cleaning | Cleaning Data |
| groupby and filters | Analysis |
| Charts | Visualization |
| Statistics and models | Statistics and ML |
Questions
Exercise
What does df.shape return for the DataFrame above?
Exercise
Which code selects only the students from Karachi?
Exercise
Which code keeps students from Lahore with marks above 85?
Exercise
What does df["marks"].fillna(0) do?
Exercise
Which method removes repeated identical rows?
Exercise
What is the result of df.groupby("city")["marks"].mean() for Lahore?
Exercise
Which chart is best for showing the relationship between study hours and marks?
Exercise
A correlation of -0.9 between two columns means:
Exercise
In scikit-learn, which method trains a model on data?
Exercise
Why do we split data into training and test sets?
