Emotion Classification 8

PHOTO EMBED

Sat Apr 22 2023 19:51:50 GMT+0000 (Coordinated Universal Time)

Saved by @kentrickfelix #python

# Adding the labels from part #4 to df_emotions dataframe
df_emotions_labeled = df_emotions
df_emotions_labeled['clustering_label'] = labels

# Build dummy variables based on the clustering_label column
clustering_label_dummy = pd.get_dummies(df_emotions_labeled['clustering_label'], prefix='cluster', drop_first=True)
# combine the dummy variables with the original DataFrame
df_emotions_labeled = pd.concat([df_emotions_labeled, clustering_label_dummy], axis=1)
# Drop clustering_label column
df_emotions_labeled = df_emotions_labeled.drop('clustering_label', axis=1)

df_emotions_labeled
content_copyCOPY