<h4 dir="auto">Code Sample, a copy-pastable example if possible</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; foo = pd.DataFrame({&quot;A&quot;:[&quot;One&quot;,&quot;Three&quot;,&quot;Four&quot;], &quot;B&quot;: range(3)})
&gt;&gt;&gt; print(foo.to_string())
       A  B
0    One  0
1  Three  1
2   Four  2
&gt;&gt;&gt; print(foo.to_string(index=False))
A  B
  One  0
Three  1
 Four  2"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">foo</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">"A"</span>:[<span class="pl-s">"One"</span>,<span class="pl-s">"Three"</span>,<span class="pl-s">"Four"</span>], <span class="pl-s">"B"</span>: <span class="pl-en">range</span>(<span class="pl-c1">3</span>)})
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">print</span>(<span class="pl-s1">foo</span>.<span class="pl-en">to_string</span>())
       <span class="pl-v">A</span>  <span class="pl-v">B</span>
<span class="pl-c1">0</span>    <span class="pl-v">One</span>  <span class="pl-c1">0</span>
<span class="pl-c1">1</span>  <span class="pl-v">Three</span>  <span class="pl-c1">1</span>
<span class="pl-c1">2</span>   <span class="pl-v">Four</span>  <span class="pl-c1">2</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">print</span>(<span class="pl-s1">foo</span>.<span class="pl-en">to_string</span>(<span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-c1">False</span>))
<span class="pl-v">A</span>  <span class="pl-v">B</span>
  <span class="pl-v">One</span>  <span class="pl-c1">0</span>
<span class="pl-v">Three</span>  <span class="pl-c1">1</span>
 <span class="pl-v">Four</span>  <span class="pl-c1">2</span></pre></div>
<h4 dir="auto">Problem description</h4>
<p dir="auto">Columns headers lose alignment when <code class="notranslate">to_string</code> is passed <code class="notranslate">index=False</code>.</p>
<h4 dir="auto">Expected Output</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; print(foo.to_string())
    A  B
  One  0
Three  1
 Four  2"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-en">print</span>(<span class="pl-s1">foo</span>.<span class="pl-en">to_string</span>())
    <span class="pl-v">A</span>  <span class="pl-v">B</span>
  <span class="pl-v">One</span>  <span class="pl-c1">0</span>
<span class="pl-v">Three</span>  <span class="pl-c1">1</span>
 <span class="pl-v">Four</span>  <span class="pl-c1">2</span></pre></div>
<h4 dir="auto">Output of <code class="notranslate">pd.show_versions()</code></h4>
<details>
<h2 dir="auto">INSTALLED VERSIONS</h2>
<p dir="auto">commit: None<br>
python: 3.5.2.final.0<br>
python-bits: 64<br>
OS: Linux<br>
OS-release: 4.4.0-43-Microsoft<br>
machine: x86_64<br>
processor: x86_64<br>
byteorder: little<br>
LC_ALL: C.UTF-8<br>
LANG: C.UTF-8<br>
LOCALE: en_US.UTF-8</p>
<p dir="auto">pandas: 0.22.0<br>
pytest: None<br>
pip: 10.0.1<br>
setuptools: 39.1.0<br>
Cython: None<br>
numpy: 1.14.3<br>
scipy: 1.1.0<br>
pyarrow: None<br>
xarray: None<br>
IPython: 6.4.0<br>
sphinx: None<br>
patsy: None<br>
dateutil: 2.7.3<br>
pytz: 2018.4<br>
blosc: None<br>
bottleneck: None<br>
tables: None<br>
numexpr: None<br>
feather: None<br>
matplotlib: None<br>
openpyxl: None<br>
xlrd: 1.1.0<br>
xlwt: None<br>
xlsxwriter: None<br>
lxml: None<br>
bs4: None<br>
html5lib: 1.0.1<br>
sqlalchemy: None<br>
pymysql: None<br>
psycopg2: 2.7.4 (dt dec pq3 ext lo64)<br>
jinja2: 2.10<br>
s3fs: None<br>
fastparquet: None<br>
pandas_gbq: None<br>
pandas_datareader: None</p>
</details>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[...]
reading sources... [ 75%] io
Exception occurred while building, starting debugger:
Traceback (most recent call last):
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\cmdline.py&quot;, line 246, in
main
    app.build(force_all, filenames)
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\application.py&quot;, line 212,
 in build
    self.builder.build_update()
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\builders\__init__.py&quot;, lin
e 214, in build_update
    'out of date' % len(to_build))
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\builders\__init__.py&quot;, lin
e 234, in build
    purple, length):
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\builders\__init__.py&quot;, lin
e 134, in status_iterator
    for item in iterable:
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\environment.py&quot;, line 470,
 in update_generator
    self.read_doc(docname, app=app)
  File &quot;c:\portabel\python27\lib\site-packages\sphinx\environment.py&quot;, line 621,
 in read_doc
    raise SphinxError(str(err))
SphinxError: 'utf8' codec can't decode byte 0x84 in position 25: invalid start b
yte"><pre class="notranslate"><code class="notranslate">[...]
reading sources... [ 75%] io
Exception occurred while building, starting debugger:
Traceback (most recent call last):
  File "c:\portabel\python27\lib\site-packages\sphinx\cmdline.py", line 246, in
main
    app.build(force_all, filenames)
  File "c:\portabel\python27\lib\site-packages\sphinx\application.py", line 212,
 in build
    self.builder.build_update()
  File "c:\portabel\python27\lib\site-packages\sphinx\builders\__init__.py", lin
e 214, in build_update
    'out of date' % len(to_build))
  File "c:\portabel\python27\lib\site-packages\sphinx\builders\__init__.py", lin
e 234, in build
    purple, length):
  File "c:\portabel\python27\lib\site-packages\sphinx\builders\__init__.py", lin
e 134, in status_iterator
    for item in iterable:
  File "c:\portabel\python27\lib\site-packages\sphinx\environment.py", line 470,
 in update_generator
    self.read_doc(docname, app=app)
  File "c:\portabel\python27\lib\site-packages\sphinx\environment.py", line 621,
 in read_doc
    raise SphinxError(str(err))
SphinxError: 'utf8' codec can't decode byte 0x84 in position 25: invalid start b
yte
</code></pre></div>
<p dir="auto">The problem is the following line in io.rst:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="   data = 'word,length\nTr\xe4umen,7\nGr\xfc\xdfe,5'"><pre class="notranslate"><code class="notranslate">   data = 'word,length\nTr\xe4umen,7\nGr\xfc\xdfe,5'
</code></pre></div>