Skip to content

Instantly share code, notes, and snippets.

@srishtis
Last active September 15, 2018 07:10
Show Gist options
  • Save srishtis/32b751b0be9f6c604d6e136f8bf90952 to your computer and use it in GitHub Desktop.
Save srishtis/32b751b0be9f6c604d6e136f8bf90952 to your computer and use it in GitHub Desktop.
Kickstarter project name features
#creating features from the project name
#length of name
kick_projects['name_len'] = kick_projects.name.str.len()
# presence of !
kick_projects['name_exclaim'] = (kick_projects.name.str[-1] == '!').astype(int)
# presence of ?
kick_projects['name_question'] = (kick_projects.name.str[-1] == '?').astype(int)
# number of words in the name
kick_projects['name_words'] = kick_projects.name.apply(lambda x: len(str(x).split(' ')))
# if name is uppercase
kick_projects['name_is_upper'] = kick_projects.name.str.isupper().astype(float)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment