Encoding categorical variables
📖 Scenario: You work in a small online store. You have a list of products with their categories. You want to prepare this data for a computer program that only understands numbers, not words.
🎯 Goal: You will convert the product categories from words into numbers using encoding. This helps computers understand and analyze the data better.
📋 What You'll Learn
Create a dictionary with product names as keys and their categories as values
Create a list of unique categories
Create a dictionary that assigns a unique number to each category
Create a new dictionary with products and their encoded category numbers
Print the new encoded dictionary
💡 Why This Matters
🌍 Real World
Stores and businesses often have product categories as words. Encoding them into numbers helps in building recommendation systems and sales analysis.
💼 Career
Data scientists and analysts frequently encode categorical data to prepare datasets for machine learning models.
Progress0 / 4 steps