How to display full (non-truncated) dataframe information in html when converting from pandas dataframe to html?
I converted a pandas dataframe to an html output using the
DataFrame.to_html function. When I save this to a separate html file, the file shows truncated output.
For example, in my TEXT column,
df.head(1) will show
The film was an excellent effort...
The film was an excellent effort in deconstructing the complex social sentiments that prevailed during this period.
This rendition is fine in the case of a screen-friendly format of a massive pandas dataframe, but I need an html file that will show complete tabular data contained in the dataframe, that is, something that will show the latter text element rather than the former text snippet.
How would I be able to show the complete, non-truncated text data for each element in my TEXT column in the html version of the information? I would imagine that the html table would have to display long cells to show the complete data, but as far as I understand, only column-width parameters can be passed into the
display.max_colwidth option to
For example, in iPython, we see that the information is truncated to 50 characters. Anything in excess is ellipsized:
If you set the
display.max_colwidth option, the information will be displayed fully:
★ Back to homepage or read more recommendations: