export a dataframe to csv in python with headers code example Example: save dataframe to csv df.to_csv(file_name, sep='\t')