Which of the following statement is used to export a DataFrame to 'csv' file?
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.
Related questions:
2026: 29 May Shift 2
2025: 21 May Shift 1
2026: 23 May Shift 2