Skip to main contentSkip to solution

Which parameter of the method to_csv() is used to exclude the row label to be written to the file on disk?

Solution

✅ Correct Option: 3

In pandas, to_csv() writes the row labels (the index) as the first column by default. Setting index = False stops the index from being written to the file.


Option 1: header = False removes the column names, not the row labels.

Options 2 and 4: row and label are not parameters of to_csv().

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question