Graded Quiz: Importing Data Sets :Data Analysis with Python (IBM Data Analyst Professional Certificate) Answers 2025
1. Question 1
What Python library is primarily used for machine learning?
-
❌ pandas
-
❌ Numpy
-
❌ matplotlib
-
✅ scikit-learn
Explanation:
Scikit-learn is Python’s main machine-learning library (classification, regression, clustering).
2. Question 2
Replace column headers of DataFrame df:
-
❌ df.tail() = headers_list
-
✅ df.columns = headers_list
-
❌ df.tail(headers_list)
-
❌ df.head(headers_list)
Explanation:
Assigning to df.columns updates all column names.
3. Question 3
Load “A.csv” into a DataFrame:
-
❌ df.tail(“A.csv”)
-
✅ df = pandas.read_csv(“A.csv”)
-
❌ df.columns = “A.csv”
-
❌ pandas.load_data(“A.csv”)
Explanation:read_csv() reads CSV files into Pandas.
4. Question 4
Most appropriate data type for numeric cylinders (4, 6, 8):
-
❌ float64
-
❌ string
-
✅ int64
-
❌ object
Explanation:
The values are whole numbers → integer type.
5. Question 5
Show descriptive statistics for all columns including text:
-
❌ df.info()
-
✅ df.describe(include = “all”)
-
❌ df.summary(include=”all”)
-
❌ df.describe()
Explanation:include="all" forces describe() to include numeric + object columns.
6. Question 6
‘price’ is meant to be predicted → it is the:
-
❌ Independent variable
-
❌ Categorical variable
-
✅ Target variable
-
❌ Index variable
Explanation:
The variable being predicted is always the target.
7. Question 7
Role of sqlite3.connect():
-
❌ Exports CSV
-
✅ Opens a connection to the database file
-
❌ Fetches query results
-
❌ Defines SQL query
Explanation:connect() establishes DB access.
8. Question 8
Best library to visualize trends in used car prices:
-
❌ Numpy
-
❌ Pandas
-
❌ Scikit-learn
-
✅ Matplotlib
Explanation:
Matplotlib is the primary visualization library.
9. Question 9
Assign custom header list to DataFrame:
-
❌ headers = df.columns()
-
❌ rename.columns(df, headers)
-
❌ df.labels = headers
-
✅ df.columns = headers
Explanation:df.columns is directly assignable.
10. Question 10
First step after importing sqlite3:
-
❌ Define cursor()
-
✅ Use connect() to establish connection
-
❌ Run execute() directly
-
❌ fetchall()
Explanation:
You must connect before running any SQL.
🧾 Summary Table
| Q | Answer | Key Concept |
|---|---|---|
| 1 | scikit-learn | ML library |
| 2 | df.columns = headers_list | Rename columns |
| 3 | pandas.read_csv() | Load CSV |
| 4 | int64 | Numeric integer |
| 5 | df.describe(include=”all”) | Stats for all columns |
| 6 | Target variable | Machine learning |
| 7 | connect() | DB connection |
| 8 | Matplotlib | Visualization |
| 9 | df.columns = headers | Set headers |
| 10 | connect() | DB setup |