I have a data frame with one column which contains long text descriptions.
I would like to display all the text without truncating it, but in a manner in which the column makes wider instead of making the row higher.
If I let pandas' default settings, I get next:
But if I try to remove truncate using pd.set_option('display.max_colwidth', -1)
, the row gets higher while row width mantains almost equal:
Resize columns Select a column or a range of columns. On the Home tab, select Format > Column Width (or Column Height). Type the column width and select OK.
Highlight a cell and then click on the blue bar next to it. You'll see it represented as three dots now. It will be respected when you save and reopen later or elsewhere. There is further features and options, such as View > Collapse All Code , see here and the link here.
a keyboard shortcut for reformatting the current code-cell (default shortcut is Ctrl-L , can also be configured not to add the keyboard shortcut). a keyboard shortcut for reformatting the whole notebook (default shortcut is Ctrl-Shift-L , can also be configured not to add the keyboard shortcut).
Use the below setting to change only for 1 column.
df.style.set_properties(subset=['ad_description'], **{'width-min': '300px'})
Edits: @Haritz Laboa: Thanks for confirming that 'width-min' works and not 'width'.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With