Tutorials References Exercises Videos Menu
Website Get Certified Pro NEW

Pandas DataFrame columns Property

❮ DataFrame Reference


Example

Return the column labels of the DataFrame:

import pandas as pd

df = pd.read_csv('data.csv')

print(df.columns)
Try it Yourself »

Definition and Usage

The columns property returns the label of each column in the DataFrame.


Syntax

dataframe.columns

Return Value

A Pandas Index object, containing the column labels.


❮ DataFrame Reference