Analyzing Sales Data Using Hadoop in Cloud (EMR, Dataproc, HDInsight)
📖 Scenario: You work for a retail company that wants to analyze its sales data stored in the cloud. The data is large, so you will use Hadoop services like AWS EMR, Google Dataproc, or Azure HDInsight to process it efficiently.This project guides you through setting up a simple sales dataset, configuring a threshold for high sales, processing the data using Hadoop MapReduce style logic, and finally outputting the filtered results.
🎯 Goal: Build a simple Hadoop-style data processing pipeline in Python that mimics how cloud Hadoop services process big data. You will create sales data, set a sales threshold, filter sales above the threshold, and print the results.
📋 What You'll Learn
Create a dictionary with sales data for products and their sales numbers
Add a sales threshold variable to filter high sales
Use a for loop to filter products with sales above the threshold
Print the filtered high sales products and their sales
💡 Why This Matters
🌍 Real World
Retail companies use cloud Hadoop services like EMR, Dataproc, or HDInsight to process large sales data quickly and find important trends.
💼 Career
Data analysts and engineers use these cloud tools to handle big data and extract useful insights for business decisions.
Progress0 / 4 steps
1
Create the sales data dictionary
Create a dictionary called sales_data with these exact entries: 'Laptop': 120, 'Smartphone': 250, 'Tablet': 90, 'Headphones': 150, 'Smartwatch': 80.
Hadoop
Hint
Use curly braces {} to create a dictionary with product names as keys and sales numbers as values.
2
Set the sales threshold
Create a variable called sales_threshold and set it to 100 to filter products with sales above this number.
Hadoop
Hint
Just assign the number 100 to the variable sales_threshold.
3
Filter products with sales above the threshold
Create an empty dictionary called high_sales. Use a for loop with variables product and sales to iterate over sales_data.items(). Inside the loop, add products with sales greater than sales_threshold to high_sales.
Hadoop
Hint
Use for product, sales in sales_data.items(): to loop through the dictionary. Use an if statement to check sales.
4
Print the filtered high sales products
Write a print statement to display the high_sales dictionary.
Hadoop
Hint
Use print(high_sales) to show the filtered results.
Practice
(1/5)
1. Which cloud service is NOT commonly used to run Hadoop clusters in the cloud?
easy
A. AWS EMR
B. Google Dataproc
C. Azure HDInsight
D. Firebase Realtime Database
Solution
Step 1: Identify common Hadoop cloud services
AWS EMR, Google Dataproc, and Azure HDInsight are popular cloud services for Hadoop clusters.
Step 2: Recognize Firebase's purpose
Firebase Realtime Database is a NoSQL database service, not a Hadoop cluster service.
Final Answer:
Firebase Realtime Database -> Option D
Quick Check:
Hadoop clusters use EMR, Dataproc, HDInsight, not Firebase [OK]
Hint: Remember: Firebase is for databases, not Hadoop clusters [OK]
Common Mistakes:
Confusing Firebase with Hadoop services
Thinking all cloud services support Hadoop
Mixing database services with cluster services
2. Which of the following is the correct way to start an AWS EMR cluster using AWS CLI?
easy
A. aws emr launch --cluster TestCluster --app Hadoop
B. aws emr create-cluster --name "TestCluster" --release-label emr-6.5.0 --applications Name=Hadoop
C. aws emr start-cluster --cluster-name TestCluster --version 6.5.0
D. aws emr init --name TestCluster --app Hadoop
Solution
Step 1: Understand AWS EMR CLI command structure
The correct command to create a cluster is 'aws emr create-cluster' with parameters for name, release label, and applications.
Step 2: Check each option's syntax
aws emr create-cluster --name "TestCluster" --release-label emr-6.5.0 --applications Name=Hadoop matches the correct syntax. Options A, B, and D use incorrect commands or parameters.