Table Of Contents

Search

Enter search terms or a module, class or function name.

pandas.Series.to_csv

Series.to_csv(path=None, index=True, sep=', ', na_rep='', float_format=None, header=False, index_label=None, mode='w', encoding=None, compression=None, date_format=None, decimal='.')[source]

Write Series to a comma-separated values (csv) file

Parameters:

path : string or file handle, default None

File path or object, if None is provided the result is returned as a string.

na_rep : string, default ‘’

Missing data representation

float_format : string, default None

Format string for floating point numbers

header : boolean, default False

Write out series name

index : boolean, default True

Write row names (index)

index_label : string or sequence, default None

Column label for index column(s) if desired. If None is given, and 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’

sep : character, default “,”

Field delimiter for the output file.

encoding : string, optional

a string representing the encoding to use if the contents are non-ascii, for python versions prior to 3

compression : string, optional

A string representing the compression to use in the output file. Allowed values are ‘gzip’, ‘bz2’, ‘zip’, ‘xz’. This input is only used when the first argument is a filename.

date_format: string, default None

Format string for datetime objects.

decimal: string, default ‘.’

Character recognized as decimal separator. E.g. use ‘,’ for European data

Scroll To Top