Home > Back-end >  How to display the column names vertically in Google colab?
How to display the column names vertically in Google colab?

Time:10-02

In google colab, my df.columns used to display column names vertically like below

Index(['col1',

   'col2',

   'col3],

dtype='object')

I was trying different pandas setup options like pd.set_option('display.max_row',100), pd.set_option('display.max_columns',100), width, etc. for another issue.

Now, df.columns displays like this:

Index(['col1', 'col2', 'col3], dtype='object')

I tried deleting the options, resetting its width, but couldn't fix it. How do I get back to display the columns vertically?

CodePudding user response:

Transpose your data frame (df.T). This is Right?

CodePudding user response:

import pprint 
columns = df.index

pp = pprint.PrettyPrinter(indent=4, width=1)
pprint.pprint(columns)

  • Related