The DataFrame.axes
attribute in Pandas is used to return a list of values representing the axes of a given DataFrame. It also returns the labels of the row and columns axis as the only member.
DataFrame.axes attribute
This attribute takes no parameter value.
This attribute returns a list showing the labels of the row and column axis labels as the only members in that order.
import pandas as pd# creating a dataframedf = pd.DataFrame({'AGE': [ 20, 29],'HEIGHT': [94, 170],'WEIGHT': [80, 115]})# obtaining the list representing the axes of dfprint(df.axes)
pandas
module.df
.DataFrame.axes
attribute to obtain the list representing the axes of df
. We print the result to the console.