Introduction
In this tutorial, we want to read an Excel file into a Pandas DataFrame. In order to do this, we use the read_excel() function of Pandas.
Import Libraries
First, we import the following python modules:
import pandas as pd
Excel File
We consider the sheet "Frameworks" of the Excel file "frameworks.xlsx" containing the following data:
We have to keep in mind the following attributes of the Excel file:
- File includes a header with the column names.
- Sheet name is "Frameworks".
- File path is "data/frameworks.xlsx".
Read Excel File into Pandas DataFrame
Next, we would like to read the Excel file into a Pandas DataFrame.
To do this, we use the read_excel() function of Pandas:
df = pd.read_excel("data/frameworks.xlsx", sheet_name="Frameworks")
df
Conclusion
Congratulations! Now you are one step closer to become an AI Expert. You have seen that it is very easy to read an Excel file into a Pandas DataFrame. We can simply use the read_excel() function of Pandas. Try it yourself!
Also check out our Instagram page. We appreciate your like or comment. Feel free to share this post with your friends.