Pandas DataFrame columns Property
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.
Copyright 1999-2023 by Refsnes Data. All Rights Reserved.