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?
- A.
dFb
- B.
data.index ( )
- C.
set_index ( )
- 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.