Data frame in Pandas has a method which takes a column name (for a regular…

2024

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. A.

    dFb

  2. B.

    data.index ( )

  3. C.

    set_index ( )

  4. D.

    dFmi

Attempted by 24 students.

Show answer & explanation

Correct answer: C

In pandas, `set_index()` is used to create a new DataFrame indexed by one or more existing columns.

Explore the full course: Hpsc Pgt Computer Science