Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
3.2k views
in General by (29.7k points)

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)

Please log in or register to answer this question.

1 Answer

+1 vote
by (29.6k points)

i. c. df['Name'][(df['Second']>=12) & (df['Second']<=20)]

ii. b. print(df.iloc[::-1])

iii. d. df.tail(3)

iv. b. Name

v. a. df.size

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...