Skip to content

Instantly share code, notes, and snippets.

@srang992
Created April 12, 2023 16:55
Show Gist options
  • Save srang992/a5be02d6da4b66ce62d65d9b5ae27255 to your computer and use it in GitHub Desktop.
Save srang992/a5be02d6da4b66ce62d65d9b5ae27255 to your computer and use it in GitHub Desktop.
# filtering the taste of Kokoa Kamili and separating the values
taste_encode = choco_data[choco_data['bar_name'].isin(['Kokoa Kamili'])]['taste'].str.get_dummies(sep=', ')
# fixing some of the values whose pronunciation is wrong
taste_encode['nuts'] = taste_encode['nut'] + taste_encode['nuts']
taste_encode['rich_cocoa'] = taste_encode['rich'] + taste_encode['rich cocoa'] + taste_encode['rich cooa']
# dropping the columns containing wrong pronunciation
taste_encode.drop(['nut', 'rich', 'rich cooa'], axis=1, inplace=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment