Skip to content

Instantly share code, notes, and snippets.

@hunterowens
Created January 14, 2018 19:50
Show Gist options
  • Save hunterowens/953b89a38d498ab74d19c72c5fb273fb to your computer and use it in GitHub Desktop.
Save hunterowens/953b89a38d498ab74d19c72c5fb273fb to your computer and use it in GitHub Desktop.
example_catagory
def catagorize(row):
"""
apply function to catagorize a set of traing data values into
catagories.
"""
sentiment = 0
focus = 0
energy_level = 0 ## TODO replace with real
if sentiment > 0:
if focus > 0: # focus outward
if energy_level > .25:
return "connected"
elif energy_level < -.25:
return "tolerant"
else:
return "vunerable"
else: # focus inward
if energy_level > .25:
return "hopeful"
elif energy_level < -.25:
return "calm"
else:
return "happy"
elif sentiment <= 0:
if focus > 0: #focus outward
if energy_level > .25:
return "angry"
elif energy_level < -.25:
return "lonely"
else:
return "guarded"
else: #focus inward
if energy_level > .25:
return "anxious"
elif energy_level < -.25:
return "sad"
else:
return "fearful"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment