Problem 4: Compare Original and Encoded Data
Easypython
Problem Description
Write a Python program that takes a categorical "size" column ("Small," "Medium," "Large"), applies Label Encoding respecting the correct order, and prints a side-by-side comparison of the original and encoded values.
Input
A DataFrame with a "size" column.
Output
A side-by-side view of the original and encoded "size" values.
Constraints
- Only these three size values will appear.
Example Input
text{"size": ["Medium", "Small", "Large"]}
Example Output
textsize size_encoded 0 Medium 1 1 Small 0 2 Large 2
Concepts Covered
Custom ordinal mapping, .map(), DataFrame comparison.