YasserKhalil
YasserKhalil

Reputation: 9568

Set column width in pandas dataframe

Searching for this topic and found a solution but doesn't work for me The code I am working on (part of it like that)

pd.set_option('max_colwidth', 1000)
df = pd.DataFrame(list)

The line of setting the max colwidth: I tried to put this line before the df line and another try after the df line but the output still the same.. Any ideas?

Upvotes: 6

Views: 16401

Answers (2)

Cam
Cam

Reputation: 1763

So I am using pandas version 2.2.0 'display.width' did not work for me. But max_colwidth did.

Try:- pd.set_option("max_colwidth", 500)

Check what pandas version you have installed with print(pd.__version__)

Upvotes: 1

Sunny
Sunny

Reputation: 302

You can try setting the others parameters also like:

pd.set_option('display.max_columns', 1000, 'display.width', 1000, 'display.max_rows',1000)

Upvotes: 4

Related Questions