Home > Software engineering >  Displaying pandas dataframe rows in a single line
Displaying pandas dataframe rows in a single line

Time:08-17

I want to display the rows of my pandas dataframe in a single line for each row. However, when the number of columns gets larger some columns shrink in width, forcing the contents of the columns onto the next line. How can I avoid this?

What I want: enter image description here

What I do not want: enter image description here

Thanks for any suggestions.

CodePudding user response:

You may reduce the number of columns shown each time you call a dataframe with:

pd.options.display.max_columns = 7

I set it as 7 but feel free to change it.

CodePudding user response:

You could try pd.set_option('max_colwidth', 60) and change the '60' to whatever you want.

  • Related