To write a Python Pandas DataFrame to CSV file, we call the to_csv method on the data frame.
For instance, we write
df.to_csv(file_name, encoding='utf-8', index=False)
to call to_csv on the df data frame.
file_name is the path of the output file.
encoding sets the CSV encoding.
We hide the row index by setting index to false.