0
0
Pandasdata~30 mins

Reading Excel files with read_excel in Pandas - Mini Project: Build & Apply

Choose your learning style9 modes available
Reading Excel files with read_excel
📖 Scenario: You work in a small company that keeps sales data in Excel files. You want to learn how to read this data into Python to analyze it easily.
🎯 Goal: Learn how to use pandas.read_excel to load Excel data into a DataFrame and display it.
📋 What You'll Learn
Use pandas library
Read an Excel file named sales_data.xlsx
Load the data into a DataFrame called df
Print the DataFrame to see the data
💡 Why This Matters
🌍 Real World
Many companies store data in Excel files. Being able to read Excel files into Python lets you analyze and visualize data easily.
💼 Career
Data analysts and data scientists often import Excel data to clean, analyze, and report insights.
Progress0 / 4 steps
1
Create a sample Excel file
Create a dictionary called data with these exact entries: 'Product': ['Pen', 'Notebook', 'Eraser'] and 'Sales': [100, 150, 50]. Then use pandas.DataFrame to create a DataFrame called df from this dictionary.
Pandas
Need a hint?

Use data = {'Product': [...], 'Sales': [...]} and then df = pd.DataFrame(data).

2
Save the DataFrame to an Excel file
Use the to_excel method on df to save the data to a file named 'sales_data.xlsx'. Include index=False to avoid saving row numbers.
Pandas
Need a hint?

Use df.to_excel('sales_data.xlsx', index=False) to save the file.

3
Read the Excel file into a DataFrame
Use pandas.read_excel to read the file 'sales_data.xlsx' into a new DataFrame called df.
Pandas
Need a hint?

Use df = pd.read_excel('sales_data.xlsx') to load the Excel file.

4
Print the DataFrame to see the data
Write a print statement to display the DataFrame df.
Pandas
Need a hint?

Use print(df) to show the data.