Sanyukta is the event incharge in a school. One of her students gave her a suggestion to use Python Pandas and Matplotlib for analysing and visualising the data, respectively. She has created a Data frame “Sports Day” to keep track of the number of First, Second and Third prizes won by different houses in various events.
Write Python commands to do the following:
i. Display the house names where the number of Second Prizes are in the range of 12 to 20.
a. df['Name'][(df['Second']>=12) and (df['Second']<=20)]
b. df[Name][(df['Second']>=12) & (df['Second']<=20)]
c. df['Name'][(df['Second']>=12) & (df['Second']<=20)]
d. df[(df['Second']>=12) & (df['Second']<=20)]
ii. Display all the records in the reverse order.
a. print(df[::1])
b. print(df.iloc[::-1])
c. print(df[-1:]+df[:-1])
d. print(df.reverse())
iii. Display the bottom 3 records.
a. df.last(3)
b. df.bottom(3)
c. df.next(3)
d. df.tail(3)
iv. Choose the correct output for the given statements:
x=df.columns[:1]
print(x)
a. 0
b. Name
c. First
d. Error
v. Which command will give the output 24:
a. print(df.size)
b. print(df.shape)
c. print(df.index)
d. print(df.axes)