Skip to content

Table headers misaligned with to_string(index=False) #21095

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
andrewdalecramer opened this issue May 17, 2018 · 3 comments
Closed

Table headers misaligned with to_string(index=False) #21095

andrewdalecramer opened this issue May 17, 2018 · 3 comments
Labels
Bug Duplicate Report Duplicate issue or pull request Output-Formatting __repr__ of pandas objects, to_string

Comments

@andrewdalecramer
Copy link

Code Sample, a copy-pastable example if possible

>>> foo = pd.DataFrame({"A":["One","Three","Four"], "B": range(3)})
>>> print(foo.to_string())
       A  B
0    One  0
1  Three  1
2   Four  2
>>> print(foo.to_string(index=False))
A  B
  One  0
Three  1
 Four  2

Problem description

Columns headers lose alignment when to_string is passed index=False.

Expected Output

>>> print(foo.to_string())
    A  B
  One  0
Three  1
 Four  2

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.5.2.final.0
python-bits: 64
OS: Linux
OS-release: 4.4.0-43-Microsoft
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: C.UTF-8
LANG: C.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.22.0
pytest: None
pip: 10.0.1
setuptools: 39.1.0
Cython: None
numpy: 1.14.3
scipy: 1.1.0
pyarrow: None
xarray: None
IPython: 6.4.0
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.4
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 1.0.1
sqlalchemy: None
pymysql: None
psycopg2: 2.7.4 (dt dec pq3 ext lo64)
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@mroeschke
Copy link
Member

Confirmed the latest release, v0.23.0. PRs welcome!

@mroeschke mroeschke added Bug Output-Formatting __repr__ of pandas objects, to_string labels May 19, 2018
@jreback
Copy link
Contributor

jreback commented May 19, 2018

this is a duplicate issue

@mroeschke
Copy link
Member

Duplicate of #13032

@mroeschke mroeschke marked this as a duplicate of #13032 May 19, 2018
@mroeschke mroeschke added the Duplicate Report Duplicate issue or pull request label May 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Duplicate Report Duplicate issue or pull request Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

No branches or pull requests

3 participants