0
0
Pandasdata~15 mins

describe() for statistical summary in Pandas - Mini Project: Build & Apply

Choose your learning style9 modes available
Using describe() for Statistical Summary in pandas
📖 Scenario: You work as a data analyst for a small online store. You have collected sales data for the last week, including the number of items sold and the price of each item. You want to quickly understand the basic statistics of this data to see how sales are doing.
🎯 Goal: Build a simple pandas DataFrame with sales data and use the describe() method to get a statistical summary of the data.
📋 What You'll Learn
Create a pandas DataFrame with exact sales data
Add a variable to select numeric columns
Use the describe() method on the DataFrame
Print the statistical summary output
💡 Why This Matters
🌍 Real World
Statistical summaries help quickly understand data trends and spot unusual values in sales, finance, or any numeric data.
💼 Career
Data analysts and scientists use describe() to get fast insights before deeper analysis or reporting.
Progress0 / 4 steps
1
Create the sales data DataFrame
Create a pandas DataFrame called sales_data with these exact columns and values:
'item': ['apple', 'banana', 'orange', 'apple', 'banana'],
'quantity': [10, 5, 8, 7, 3],
'price': [0.5, 0.3, 0.7, 0.5, 0.3]
Pandas
Need a hint?

Use pd.DataFrame and pass a dictionary with keys as column names and values as lists of data.

2
Select numeric columns for summary
Create a variable called numeric_cols that selects only the numeric columns from sales_data using select_dtypes(include=['number'])
Pandas
Need a hint?

Use select_dtypes(include=['number']) on the DataFrame to get numeric columns.

3
Get statistical summary using describe()
Use the describe() method on numeric_cols and save the result in a variable called summary
Pandas
Need a hint?

Call describe() on the numeric columns DataFrame and assign it to summary.

4
Print the statistical summary
Print the variable summary to display the statistical summary of the numeric sales data
Pandas
Need a hint?

Use print(summary) to show the statistical summary.