Pandas DataFrame keys() Method
Example
Return the column names of the DataFrame:
    import pandas as pd
data = {
  "firstname": ["Sally", "Mary", 
    "John"],
  "age": [50, 40, 30]
}
df = pd.DataFrame(data)
    
print(df.keys())
  Try it Yourself »
Definition and Usage
The keys() method returns a Index object 
with the column names.
The Index object is like a list, with the column names as list items.
Syntax
  
    dataframe.keys():
Parameters
The keys() method takes no parameters.
Return Value
An Index object with the columns names.