Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Support different delimiters for to_csv #244

wants to merge 3 commits into from

2 participants


This pull requests implements delimter support into to_csv. A number of analysis tools expects TSV files rather than CSV files, and this is a simple solution to the problem.

The delimiter parameter is by default ",", hence there are no side effects with existing code.


thanks! merged it into master

@wesm wesm closed this

i'm going to change the argument name to sep instead of delimiter to conform with read_csv and read_table

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +4 −2 pandas/core/
6 pandas/core/
@@ -469,7 +469,7 @@ def to_sparse(self, fill_value=None, kind='block'):
def to_csv(self, path, nanRep='', cols=None, header=True,
- index=True, index_label=None, mode='w'):
+ index=True, index_label=None, mode='w', delimiter=","):
Write DataFrame to a comma-separated values (csv) file
@@ -489,9 +489,11 @@ def to_csv(self, path, nanRep='', cols=None, header=True,
`header` and `index` are True, then the index names are used. A
sequence should be given if the DataFrame uses MultiIndex.
mode : Python write mode, default 'w'
+ delimiter : character, default ","
+ Field delimiter for the output file.
f = open(path, mode)
- csvout = csv.writer(f, lineterminator='\n')
+ csvout = csv.writer(f, lineterminator='\n', delimiter=delimiter)
if cols is None:
cols = self.columns
Something went wrong with that request. Please try again.