Search⌘ K
AI Features

Loading an Excel Dataset into a DataFrame

Explore how to load Excel datasets into pandas DataFrames using the read_excel() function. Understand using parameters such as nrows, sheet_name, and names to control data import and customize columns for analysis.

Loading Excel files

Sometimes we can store data inside other data sources, such as Excel files. We can also store this data online and access it through a URL.

To import such data, we use the read_excel() pandas function.

Python 3.8
import pandas as pd
excel_df = pd.read_excel("https://github.com/CourseMaterial/DataWrangling/blob/main/housing.xlsx?raw=true")
print(excel_df.tail())

Let’s review the code line by line:

  • Line 1: We import the pandas library.

  • Line 2: We use the read_excel() function to read the Excel file with the URL https://bit.ly/housingexcelds and store it in excel_df.

  • ...