English

Which of the following Python statements is used to write a Pandas DataFrame df to a CSV file? - Informatics Practices

Advertisements
Advertisements

Question

Which of the following Python statements is used to write a Pandas DataFrame df to a CSV file?

Options

  • df.to_csv()
  • df.write_csv()
  • df.to_table()
  • df.export_csv()
MCQ
Advertisements

Solution

df.to_csv()

Explanation:

In Pandas, the to_csv() function is used to write (export) a DataFrame to a CSV file.

Example:

df.to_csv("data.csv", index=False)
shaalaa.com
  Is there an error in this question or solution?
2025-2026 (March) Board Sample Paper
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×