Haritz Laboa
Haritz Laboa

Reputation: 778

Change the cell width of a data frame in Jupyter Notebook

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:

enter image description here


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:

enter image description here

Upvotes: 11

Views: 15381

Answers (1)

vb_rises
vb_rises

Reputation: 1907

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'.

Upvotes: 10

Related Questions