Creating Interaction Features
📖 Scenario: You work as a data analyst for an online store. You have a small dataset with information about products: their price and quantity sold. You want to create a new feature that shows the total sales value for each product by multiplying price and quantity.
🎯 Goal: Build a small program that creates a dictionary with product prices and quantities, then creates a new dictionary with the total sales value for each product by multiplying price and quantity.
📋 What You'll Learn
Create a dictionary called
prices with product names as keys and their prices as values.Create a dictionary called
quantities with product names as keys and quantities sold as values.Create a new dictionary called
total_sales where each product's value is the product of its price and quantity.Print the
total_sales dictionary.💡 Why This Matters
🌍 Real World
Creating interaction features like total sales helps businesses understand product performance and make better decisions.
💼 Career
Data analysts and data scientists often create new features by combining existing data to improve models and insights.
Progress0 / 4 steps