Skip to content

Instantly share code, notes, and snippets.

@wandabwa2004
Created December 15, 2020 08:08
Show Gist options
  • Save wandabwa2004/b11ea6289179227f3dfd2d28c5b1b07d to your computer and use it in GitHub Desktop.
Save wandabwa2004/b11ea6289179227f3dfd2d28c5b1b07d to your computer and use it in GitHub Desktop.
#A little clean up
df_final_copy['tweet'] = df_final_copy['tweet'].map(lambda x:re.sub('[^a-zA-Z]',' ',str(x)))
#remove links or anything starting with http
df_final_copy['tweet'] = df_final_copy['tweet'].map(lambda x:re.sub('http.*','',str(x)))
#remove hashtags
df_final_copy['tweet'] = df_final_copy['tweet'].map(lambda x:re.sub(r'#','',str(x)))
df_final_copy['tweet'] = df_final_copy['tweet'].map(lambda x:re.sub(r'@\w*','',str(x)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment