CBSE Class 12 Informatics Practices Question 42 of 44

Solved 2025 Sample Question Paper CBSE Class 12 Informatics Practices (065) — Question 2

Back to all questions
2
Question

Question 36

Consider the DataFrame df shown below.

 MovieIDTitleYearRating
01LAGAAN20018.4
12TAARE ZAMEEN PAR20078.5
233 IDIOTS20098.4
34DANGAL20168.4
45ANDHADHUN20188.3

Write Python statements for the DataFrame df to:

I. Print the first two rows of the DataFrame df.

II. Display titles of all the movies.

III. Remove the column rating.

IV. Display the data of the 'Title' column from indexes 2 to 4 (both included)

V. Rename the column name 'Title' to 'Name'.

Answer

I. print(df.head(2))

II. print(df['Title'])

III. df = df.drop(‘Rating’, axis=1)

IV. print(df.loc[2:4,'Title'])

V. df.rename(columns={'Title':'Name'}, inplace=True)