Skip to content

Instantly share code, notes, and snippets.

@fclesio
Created July 3, 2019 10:38
Show Gist options
  • Save fclesio/97de0b621fed6caa2df4332ed8d11e55 to your computer and use it in GitHub Desktop.
Save fclesio/97de0b621fed6caa2df4332ed8d11e55 to your computer and use it in GitHub Desktop.
# Convert the lyrics to string to not break the posterior converts
df_raw_lyrics['lyric'] = df_raw_lyrics['lyric'].astype(str)
# Remove all stopwords
df_raw_lyrics['lyric'] = df_raw_lyrics['lyric']\
.apply(lambda x: ' '.join([item for item in x.lower()\
.split() if item not in stoplist]))
# Quick check
df_raw_lyrics.head(5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment