0
0
Data Analysis Pythondata~30 mins

Distribution plots (histplot, kdeplot) in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Distribution plots (histplot, kdeplot)
📖 Scenario: You work as a data analyst for a small bakery. You have collected data on the number of cookies sold each day for a week. You want to understand how the sales are distributed to help plan baking quantities.
🎯 Goal: Build a simple Python program that creates a list of daily cookie sales, sets a threshold for high sales, uses distribution plots (histogram and KDE) to visualize the sales data, and prints the sales data.
📋 What You'll Learn
Create a list of daily cookie sales with exact values
Create a threshold variable for high sales
Use seaborn to plot a histogram and KDE plot of the sales data
Print the sales data list
💡 Why This Matters
🌍 Real World
Distribution plots help businesses understand how their data points, like daily sales, are spread out. This helps in planning and decision making.
💼 Career
Data analysts and scientists use distribution plots to explore data patterns and communicate insights clearly to teams and managers.
Progress0 / 4 steps
1
Create the daily sales data list
Create a list called daily_sales with these exact values: 12, 15, 14, 10, 18, 20, 16 representing cookies sold each day.
Data Analysis Python
Hint

Use square brackets to create a list and separate numbers with commas.

2
Set a threshold for high sales
Create a variable called high_sales_threshold and set it to 15 to mark days with high cookie sales.
Data Analysis Python
Hint

Just assign the number 15 to the variable named high_sales_threshold.

3
Plot the distribution of daily sales
Import seaborn as sns and matplotlib.pyplot as plt. Use sns.histplot to plot a histogram of daily_sales with kde=True to add a smooth curve. Then call plt.show() to display the plot.
Data Analysis Python
Hint

Use sns.histplot with kde=True to add the smooth curve on the histogram.

4
Print the daily sales data
Write a print statement to display the daily_sales list.
Data Analysis Python
Hint

Use print(daily_sales) to show the list.