Data Science Tutorial menu

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

python
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())
Output
city
Karachi    67.0
Lahore     89.0
Name: marks, dtype: float64

If you miss a question, go back to the matching chapter:

TopicChapter
DataFrames, loc and ilocPandas Basics
CleaningCleaning Data
groupby and filtersAnalysis
ChartsVisualization
Statistics and modelsStatistics 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?

Learn Data Science with a teacher

Join the Python Programming course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp