Skip to content

Instantly share code, notes, and snippets.

@samkit-jain
Last active December 13, 2017 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samkit-jain/f1fff588be4a74532d5201047e9b2de1 to your computer and use it in GitHub Desktop.
Save samkit-jain/f1fff588be4a74532d5201047e9b2de1 to your computer and use it in GitHub Desktop.
# method to categorize a particular
def categorize(particular):
# tokenizing
word_list = tokenize(particular)
# multiple similar statements
if keyword in word_list:
return category
# iterate over all transactions
for transaction in final_result:
# assign category
transaction['category'] = categorize(transaction['particular'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment