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?
