1

I am using Spyder to read a CSV file with many columns. I would like to customize the width of column displayed in console.

I have tried to use set_option to set column width. It works for columns but doesn't work for column labels.

pd.set_option("display.max_colwidth",5)

snapshot of output

for example the column label "New revision distributed" is still not displayed with"...".

Anybody know how to set the column label width?

Thanks

X105
  • 11
  • 3
  • 1
    Use `pd.set_option("display.max_colwidth",5)` and try – Krk Rama Krishna Sep 24 '20 at 04:04
  • Sorry I copied wrong code in the original question, I used pd.set_option("display.max_colwidth",5), which only change the width of column (maybe it is a limited to quantity of characters) but not label width not changed. – X105 Sep 24 '20 at 06:21
  • Does this answer your question? [How do I set the column width when using pandas.DataFrame.to\_html?](https://stackoverflow.com/questions/52580111/how-do-i-set-the-column-width-when-using-pandas-dataframe-to-html) – Trenton McKinney Sep 24 '20 at 06:24
  • Does this answer your question? [How do I expand the output display to see more columns of a pandas DataFrame?](https://stackoverflow.com/questions/11707586/how-do-i-expand-the-output-display-to-see-more-columns-of-a-pandas-dataframe) – Zaraki Kenpachi Sep 24 '20 at 08:28
  • 1
    Actually they are not the same question. I am trying to set the column label width which display in Spyder's console, for a easier way to read the table. – X105 Sep 25 '20 at 01:00

0 Answers0