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
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']