Closed
Description
Code Sample, a copy-pastable example if possible
import pandas
df = pandas.DataFrame({'c': 1, 'd': 2.3}, index=[0], )
formats = {'c': '{: 10d}', 'd': '{: 2.5f}'}
formatters = {k: v.format for k, v in formats.items()}
print(df.to_string(formatters=formatters, index=False, header=True))
print(df.to_string(formatters=formatters, index=False, header=False))
Problem description
I expect the spaces in the beginning, but they don't appear when header=False
.
u'c d\n 1 2.30000'
'1 2.30000'
Expected Output
u'c d\n 1 2.30000'
' 1 2.30000'
Output of pd.show_versions()
# Paste the output here pd.show_versions() here
INSTALLED VERSIONS
------------------
commit: None
python: 2.7.12.final.0
python-bits: 64
OS: Linux
OS-release: 4.8.0-58-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: None.None
pandas: 0.20.2
pytest: 3.1.2
pip: 9.0.1
setuptools: 36.0.1
Cython: None
numpy: 1.13.0
scipy: None
xarray: None
IPython: 5.4.1
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999999999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None