Bigdata Report
Bigdata Report
Code:
The following code processes transaction logs to identify purchasing
trends across product categories. It calculates the total sales for each
category and sorts them in descending order of popularity
group AS product_category,
SUM(transactions.total_amount) AS total_sales;
Output:
The code generates a file named category_sales_trends.csv containing
product categories and their respective total sales, sorted in descending
order. Example output:
Product Category Total Sales
Electronics ₹1,200,000
Clothing ₹800,000
Groceries ₹500,000
Explanation:
1. Load Transaction Data: The LOAD function reads transaction data
from a CSV file into Pig for analysis.
2. Group by Category: Transactions are grouped
by product_category to aggregate sales.
3. Calculate Total Sales: The SUM function computes the total sales
amount for each product category.
4. Sort Results: Categories are ordered by total_sales in descending
order to identify the most popular categories.
5. Store Output: Results are stored in a CSV file for further analysis or
reporting.
7. Recommendations
1. Inventory Management: Focus on stocking top categories like
Electronics and Fashion.
2. Marketing Strategies: Target cross-selling campaigns for popular co-
purchased items.
3. Seasonal Campaigns: Increase marketing spend during high-sales
months like November.
8. Conclusion
The analysis highlights critical areas for improvement and growth in retail
and e-commerce. By leveraging these insights, businesses can optimize
operations, enhance customer experience, and boost revenue.
9. Appendices
Appendix A: Code Snippets
Customer Purchase Patterns