Skip to main contentSkip to solution

Which of the following statement is used to export a DataFrame to 'csv' file?

Solution

✅ Correct Option: 1

In pandas, the method DataFrame.to_csv() writes a DataFrame to a CSV file. For example, df.to_csv('data.csv', index=False) saves it without the row index column.


Option 3: DataFrame.write.csv() is the PySpark syntax, not pandas.

Option 4: write_csv() belongs to other libraries (R's readr, Polars), not pandas.

Keyboard Shortcuts

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