How to read header of excel file in Python

You can read the header of excel file in Python with the following code. I highly recommend you This book to learn Python.

Read Header of Excel File

# Import the Pandas library as pd
import pandas as pd

# Read the Excel file
df = pd.read_excel("house_price.xlsx")

# Display the Header of Excel File
print(df.columns)

Output:

Index(['Area', 'Rooms', 'House_Age', 'Price'], dtype='object')

Free Learning Resources

Leave a Comment

Your email address will not be published.