0
0
Data Analysis Pythondata~30 mins

Financial data analysis pattern in Data Analysis Python - Mini Project: Build & Apply

Choose your learning style9 modes available
Financial data analysis pattern
📖 Scenario: You work as a financial analyst. You have a small dataset of monthly sales figures for different products. Your task is to analyze this data to find which products have sales above a certain threshold.
🎯 Goal: Build a simple Python program that stores sales data, sets a sales threshold, filters products with sales above the threshold, and prints the filtered results.
📋 What You'll Learn
Create a dictionary with product names as keys and monthly sales as values.
Create a variable to hold the sales threshold.
Use a dictionary comprehension to filter products with sales above the threshold.
Print the filtered dictionary showing products with sales above the threshold.
💡 Why This Matters
🌍 Real World
Financial analysts often need to filter and analyze sales data to identify top-performing products.
💼 Career
This pattern helps in preparing reports and making data-driven decisions in finance and sales roles.
Progress0 / 4 steps
1
Create the sales data dictionary
Create a dictionary called sales_data with these exact entries: 'Laptop': 1200, 'Smartphone': 850, 'Tablet': 400, 'Headphones': 150, 'Smartwatch': 300.
Data Analysis Python
Hint

Use curly braces {} to create a dictionary with keys and values separated by colons.

2
Set the sales threshold
Create a variable called threshold and set it to 500.
Data Analysis Python
Hint

Just assign the number 500 to the variable threshold.

3
Filter products with sales above threshold
Use a dictionary comprehension to create a new dictionary called high_sales that contains only the products from sales_data with sales greater than threshold. Use product and sales as the loop variables.
Data Analysis Python
Hint

Use {key: value for key, value in dict.items() if condition} to filter the dictionary.

4
Print the filtered high sales products
Print the high_sales dictionary to display the products with sales above the threshold.
Data Analysis Python
Hint

Use print(high_sales) to show the filtered dictionary.