📖 Scenario: You have a small dataset about daily sales in a store. You want to understand the data better by exploring it step-by-step.
🎯 Goal: Build a simple Exploratory Data Analysis (EDA) template in Python that loads data, sets a configuration, applies core analysis, and prints the results.
📋 What You'll Learn
Create a dictionary with sales data for 5 days
Add a threshold variable to filter days with sales above it
Use a loop to select days with sales above the threshold
Print the filtered days and their sales
💡 Why This Matters
🌍 Real World
Exploratory Data Analysis helps you understand data before making decisions. For example, a store manager can see which days have high sales.
💼 Career
Data analysts and scientists use EDA to clean and understand data before building models or reports.
Progress0 / 4 steps
1
DATA SETUP: Create the sales data dictionary
Create a dictionary called daily_sales with these exact entries: 'Monday': 150, 'Tuesday': 200, 'Wednesday': 50, 'Thursday': 300, 'Friday': 100
Data Analysis Python
Hint
Use curly braces to create a dictionary with day names as keys and sales numbers as values.
2
CONFIGURATION: Set the sales threshold
Create a variable called sales_threshold and set it to 100
Data Analysis Python
Hint
Just assign the number 100 to the variable sales_threshold.
3
CORE LOGIC: Filter days with sales above the threshold
Create a new dictionary called filtered_sales using a for loop with variables day and sales to iterate over daily_sales.items(). Add entries to filtered_sales only if sales is greater than sales_threshold
Data Analysis Python
Hint
Start with an empty dictionary. Use a for loop to check each day's sales. Add to filtered_sales only if sales are above the threshold.
4
OUTPUT: Print the filtered sales dictionary
Write a print statement to display the filtered_sales dictionary
Data Analysis Python
Hint
Use print(filtered_sales) to show the filtered dictionary.
Practice
(1/5)
1. What is the main purpose of Exploratory Data Analysis (EDA) in data science?
easy
A. To build machine learning models directly
B. To clean data without checking it
C. To understand the data quickly and find patterns
D. To create final reports without analysis
Solution
Step 1: Understand EDA's role
EDA is used to explore and understand data before any modeling or cleaning.
Step 2: Compare options
Only To understand the data quickly and find patterns correctly states EDA's purpose as understanding data quickly and finding patterns.
Final Answer:
To understand the data quickly and find patterns -> Option C
Quick Check:
EDA = Understand data fast [OK]
Hint: EDA means exploring data first, not modeling [OK]
Common Mistakes:
Confusing EDA with model building
Thinking EDA skips data checking
Assuming EDA creates final reports
2. Which Python command is commonly used to get a quick summary of a DataFrame's structure during EDA?
easy
A. df.describe()
B. df.info()
C. df.plot()
D. df.head()
Solution
Step 1: Recall DataFrame methods
df.info() shows data types, non-null counts, and memory usage.
Step 2: Compare with other methods
df.describe() gives stats, df.plot() makes graphs, df.head() shows rows. Only df.info() summarizes structure.
Final Answer:
df.info() -> Option B
Quick Check:
DataFrame structure = df.info() [OK]
Hint: Use df.info() for quick data structure summary [OK]
Common Mistakes:
Using df.describe() for structure instead of stats