Question 53Asked in Bihar STET 2025 Paper II Computer Science, 4 Nov 2025, Shift 2 (2:00 PM)

Which function should be used to get first n rows of a dataframe ?डेटाफ्रेम की पहली n पंक्तियाँ प्राप्त करने के लिए किस फ़ंक्शन का उपयोग किया जाना चाहिए?

डेटाफ्रेम की पहली n पंक्तियाँ प्राप्त करने के लिए किस फ़ंक्शन का उपयोग किया जाना चाहिए?
  1. Aprint(n)print(n)
  2. Bhead(n)head(n)
  3. Cget(n)get(n)
  4. Dcall(n)call(n)
Show answerHide answer

Correct answer: (B) head(n)head(n)

Explanation

In pandas, df.head(n) returns the first n rows of a DataFrame (5 by default). tail(n) returns the last n rows.pandas में df.head(n) DataFrame की पहली n पंक्तियाँ लौटाता है (डिफ़ॉल्ट 5)। tail(n) अंतिम n पंक्तियाँ लौटाता है।

From Bihar STET 2025 Paper II Computer Science PYQ, 4 Nov 2025, Shift 2 (2:00 PM)

This is question 53 of Bihar STET 2025 Paper II Computer Science PYQ, 4 Nov 2025, Shift 2 (2:00 PM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.