Lets say I have a dataframe:
Title1 Title2
0 420 50
1 380 40
2 390 45
How can I get as output only the name of the title of the first column (Title1) without the values of the column? I’ve tried iloc but that doesn’t work of course.
>Solution :
If dfis your dataframe, then the following should work:
first_col = df.columns[0]
See here for more info.