Pandas: Reading .xlsx or .xls Excel Files

To read an Excel file using Python pandas we can make use of the read_excel() method, this will return the Excel data in tabular form as a dataframe.

Microsoft Excel file: data.xlsx

Excel xlsx file to be read using Python Pandas


import pandas as pd

excel_file = 'data.xlsx'

dataframe = pd.read_excel(excel_file)
% python3

        Date  Temp
0 2023-01-01    22
1 2023-02-01    22
2 2023-03-01    21
3 2023-04-01    20
4 2023-05-01    19

Do checkout the official pandas documentation on read_excel method:

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap