Skip to content

Series.to_csv quotechar missing or to_csv wrong behaviour #14283

@JoaoAparicio

Description

@JoaoAparicio

Code Sample, a copy-pastable example if possible

import pandas as pd
pd.Series(['x','x,x']).to_csv('my_file.txt', index=False)

The result of this code when you open the file my_file.txt is:

x
"x,x"

Expected Output

I think that either A) we decide that Series.to_csv doesn't quote and the expected output is

x
x,x

or B) we decide that Series.to_csv quotes in the same way as DataFrame.to_csv in which case I would expect that Series.to_csv can take argument quotechar.

output of pd.show_versions()

INSTALLED VERSIONS
------------------
commit: None
python: 2.7.9.final.0
python-bits: 64
OS: Linux
OS-release: 3.19.0-68-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8

pandas: 0.18.1
nose: 1.3.4
pip: 1.5.6
setuptools: 26.1.1
Cython: None
numpy: 1.8.2
scipy: 0.14.1
statsmodels: None
xarray: None
IPython: 5.1.0
sphinx: None
patsy: None
dateutil: 2.2
pytz: 2015.7
blosc: None
bottleneck: None
tables: None
numexpr: None
matplotlib: 1.4.2
openpyxl: 2.3.5
xlrd: 1.0.0
xlwt: None
xlsxwriter: None
lxml: 3.4.2
bs4: 4.3.2
html5lib: 0.999
httplib2: 0.9.2
apiclient: 1.5.3
sqlalchemy: 0.9.8
pymysql: None
psycopg2: None
jinja2: 2.8
boto: 2.34.0
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    IO CSVread_csv, to_csv

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions