CBSE Class 12 Informatics Practices Question 98 of 167

Python Pandas — I — Question 9

Back to all questions
9
Question

Question 9

Write code statements to list the following, from a dataframe namely sales:

(a) List only columns 'Item' and 'Revenue'.

(b) List rows from 3 to 7.

(c) List the value of cell in 5th row, 'Item' column.

Answer

(a)

>>> sales[['Item', 'Revenue']]

(b)

>>> sales.iloc[2:7]

(c)

>>> sales.Item[4]