Page 246 - AI_Ver_3.0_class_11
P. 246
b. import pandas as pd
data = [1, 'Arti', 25, 2, 'Trinabh', 30, 3, 'Surbhi', 28]
df = pd.DataFrame(data)
print(df)
c. import pandas as pd
data = ['ID', 'Name', 'Age']
df = pd.DataFrame(data)
print(df)
d. import pandas as pd
data = {'ID': [1, 2, 3], 'Name': ['Arti', 'Trinabh', 'Surbhi'], 'Age': [25, 30, 28]}
df = pd.DataFrame(data)
print(df)
12. What is the method to add a new row to a DataFrame at the end?
a. add_row() b. append_row()
c. loc[] d. concat()
13. How can you delete multiple columns with specific labels from a DataFrame?
a. Using remove() method b. Using drop() method with a list of column labels
c. Using delete() method d. Using pop() method
14. What does the shape attribute of a DataFrame return?
a. The data types of each column.
b. The total number of elements in the DataFrame.
c. A tuple representing the dimensions of the DataFrame.
d. The underlying NumPy array of the DataFrame.
15. Which of the following commands will load a CSV file into a DataFrame in Pandas?
a. pd.to_csv('filename.csv') b. pd.load_csv('filename.csv')
c. pd.read_csv('filename.csv') d. pd.import_csv('filename.csv')
16. What does an accuracy score of 1.0 indicate about a machine learning model's performance?
a. All instances were classified incorrectly
b. The model has perfect classification
c. The model has an equal number of false positives and false negatives
d. The model needs more training data
B. Fill in the blanks.
1. Python has a vast and active community of developers who contribute to , , and
resources.
2. IDLE stands for .
3. The function takes the user’s input while a program executes.
4. punchuator is used in augmented assignment statements.
5. The statement helps us to test multiple conditions and follows a top-down approach.
244 Touchpad Artificial Intelligence (Ver. 3.0)-XI

