How to show all of columns name on pandas dataframe?

后端 未结 13 2015
既然无缘
既然无缘 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 09:04

    To obtain all the column names of a DataFrame, df_data in this example, you just need to use the command df_data.columns.values. This will show you a list with all the Column names of your Dataframe

    Code:

    df_data=pd.read_csv('../input/data.csv')
    print(df_data.columns.values)
    

    Output:

    ['PassengerId' 'Survived' 'Pclass' 'Name' 'Sex' 'Age' 'SibSp' 'Parch' 'Ticket' 'Fare' 'Cabin' 'Embarked']
    
    0 讨论(0)
提交回复
热议问题