REGR: to_csv(na_rep) truncates values · Issue #31447 · pandas-dev/pandas (original) (raw)

Code Sample

import pandas as pd pd.version '1.0.0rc0' pd.Series(range(8, 12)).to_csv(na_rep='-') ',0\r\n0,8\r\n1,9\r\n2,1\r\n3,1\r\n'

Problem description

Despite (or due to?) #29975 and #30146, using na_rep still makes to_csv() truncate values. In this case integers.

Expected Output

',0\r\n0,8\r\n1,9\r\n2,10\r\n3,11\r\n'

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit : None python : 3.8.1.final.0 python-bits : 64 OS : Windows OS-release : 10 machine : AMD64 processor : Intel64 Family 6 Model 142 Stepping 12, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : Dutch_Netherlands.1252

pandas : 1.0.0rc0
numpy : 1.18.1
pytz : 2019.3
dateutil : 2.8.1
pip : 20.0.2
setuptools : 41.2.0
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 2.10.3
IPython : 7.11.1
pandas_datareader: None
bs4 : None
bottleneck : None
fastparquet : None
gcsfs : None
lxml.etree : None
matplotlib : 3.1.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pytables : None
pytest : None
s3fs : None
scipy : 1.4.1
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
xlsxwriter : None
numba : None