Page 240 - Ai_V3.0_c11_flipbook
P. 240
13. In the given example, what is the correct output for creating a DataFrame using lists or arrays?
import pandas as pd
data = [['Mayur', 25],
['Esha', 30],
['Vedant', 28]]
df = pd.DataFrame(data, columns=['Name', 'Age'])
print(df)
a. Name Age b. Name Age
0 Mayur 25 0 25 Mayur
1 Esha 30 1 30 Esha
2 Vedant 28 2 28 Vedant
c. Name ID d. ID Name Age
0 Mayur 25 0 Mayur 25
1 Esha 30 1 Esha 30
2 Vedant 28 2 Vedant 28
14. Which method allows you to delete rows from a DataFrame?
a. remove() b. drop()
c. delete() d. pop()
15. Which Pandas method can be used to fill missing values with a specific value, such as the mean of a column?
a. dropna() b. fillna()
c. interpolate() d. insert()
16. Which of the following is the default delimiter that is used by the read_csv() function in Pandas?
a. Semicolon (;) b. Tab (\t)
c. Comma (,) d. Space ( )
17. Which of the following is a characteristic of the Iris dataset?
a. It contains data for 200 samples of iris flowers.
b. Each sample has six features.
c. The samples belong to three species of iris flowers.
d. It is primarily used for regression tasks.
18. Which of the following metrics measures the proportion of correctly classified instances out of the total instances?
a. Precision b. Accuracy
c. Recall d. F1-score
19. Which code snippet would you use to calculate the precision of a classification model in Python using the sklearn library?
a. metrics.accuracy_score(y_test, y_pred)
b. metrics.confusion_matrix(y_test, y_pred)
c. metrics.precision_score(y_test, y_pred, average='weighted')
d. metrics.f1_score(y_test, y_pred)
20. Which of the following metrics would be most appropriate to use when the cost of false positives is high?
a. Accuracy b. Precision
c. Recall d. F1-score
238 Touchpad Artificial Intelligence (Ver. 3.0)-XI

