Problem 1: Apply One-Hot Encoding to a Column
Easypython
Problem Description
Write a Python program that applies One-Hot Encoding to a "color" column in a DataFrame using pd.get_dummies(), and prints the resulting DataFrame.
Input
A DataFrame with a "color" column containing at least 3 unique category values.
Output
The DataFrame with the "color" column replaced by one-hot encoded binary columns.
Constraints
- None specific.
Example Input
text{"color": ["Red", "Blue", "Green", "Red"]}
Example Output
textcolor_Blue color_Green color_Red 0 False False True 1 True False False 2 False True False 3 False False True
Concepts Covered
pd.get_dummies().