擅长:python、mysql、java
<p>使用<code>__repr__</code>或<code>to_string</code>列默认被截断为50个字符。在大于0.13.1的Pandas版本中,这可以使用<code>pandas.set_printoptions()</code>来控制:</p>
<pre><code>In [64]: df
Out[64]:
A B
a this is a very long string, longer than the defau bar
b foo baz
In [65]: pandas.set_printoptions(max_colwidth=100)
In [66]: df
Out[66]:
A B
a this is a very long string, longer than the default max_column width bar
b foo baz
</code></pre>
<p>在较新版本的Pandas中,请改用此选项:</p>
<pre><code>pd.options.display.max_colwidth = 100
</code></pre>