How to show all of columns name on pandas dataframe?

后端 未结 13 2178
既然无缘
既然无缘 2020-12-07 08:24

I have a dataframe that consist of hundreds of columns, and I need to see all column names.

What I did:

In[37]:
data_all2.columns

T

13条回答
  •  一个人的身影
    2020-12-07 08:41

    You can globally set printing options. I think this should work:

    Method 1:

    pd.set_option('display.max_columns', None)
    pd.set_option('display.max_rows', None)
    

    Method 2:

    pd.options.display.max_columns = None
    pd.options.display.max_rows = None
    

    This will allow you to see all column names & rows when you are doing .head(). None of the column name will be truncated.


    If you just want to see the column names you can do:

    print(df.columns.tolist())
    

提交回复
热议问题