python - Pandas to_html() truncates string contents -
i have python pandas dataframe object containing textual data. problem is, when use to_html() function, truncates strings in output.
for example:
import pandas df = pandas.dataframe({'text': ['lorem ipsum dolor sit amet, consectetur adipiscing elit.']}) print (df.to_html()) the output truncated @ adapis...
<table border="1" class="dataframe"> <thead> <tr style="text-align: right;"> <th></th> <th>text</th> </tr> </thead> <tbody> <tr> <th>0</th> <td> lorem ipsum dolor sit amet, consectetur adipis...</td> </tr> </tbody> </table> there related question on so, uses placeholders , search/replace functionality postprocess html, avoid:
is there simpler solution problem? not find related documentation.
what seeing pandas truncating output display purposes only.
the default max_colwidth value 50 seeing.
you can set value whatever desire or can set -1 turns off:
pd.set_option('display.max_colwidth', -1) although advise against this, better set can displayed in console or ipython.
a list of options can found here: http://pandas.pydata.org/pandas-docs/stable/options.html
Comments
Post a Comment