Question 152Asked in DSSSB TGT Computer Science, 7 Feb 2024, Shift 2 (12:30 PM)

Data frame in Pandas has a method which takes a column name (for a regular index) or

Data frame in Pandas has a method which takes a column name (for a regular index) or a list of column names to create a new, re-indexed data frame, which of the following is correct method?
  1. AdFb
  2. Bdata.index ( )
  3. Cset_index ( )
  4. DdFmi
Show answerHide answer

Correct answer: (C) set_index ( )

Explanation

set_index() takes a column name or list of column names and returns a new DataFrame indexed by those columns.

From DSSSB TGT Computer Science PYQ, 7 Feb 2024, Shift 2 (12:30 PM)

This is question 152 of DSSSB TGT Computer Science PYQ, 7 Feb 2024, Shift 2 (12:30 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.