Writing a pandas DataFrame to CSV file

To delimit by a tab you can use the sep argument of to_csv:

df.to_csv(file_name, sep='\t')

To use a specific encoding (e.g. ‘utf-8’) use the encoding argument:

df.to_csv(file_name, sep='\t', encoding='utf-8')

Leave a Comment