One-hot knowledge check
A frequency table from a categorical pandas Series for a person's favorite soda is shown.
Coke 1221
Pepsi 1117
NaN 21
If one-hot encoding is completed only on this column, and this is the only column in the dataset, how many columns will be in the final dataset?
Example code:
soda_onehot = pd.get_dummies(
soda[["favorite_soda"]],
columns=["favorite_soda"]
)
Deze oefening maakt deel uit van de cursus
Working with Categorical Data in Python
Praktische interactieve oefening
Zet theorie om in actie met een van onze interactieve oefeningen.
Begin met trainen