Created
July 3, 2019 10:33
-
-
Save fclesio/8e330cc714d6d9b879132194f3e9f074 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_language(text): | |
text = str(text) | |
b = TextBlob(text) | |
return b.detect_language() | |
# Include language in the DF | |
df_raw_lyrics['lang'] = df_raw_lyrics['lyric'].apply(get_language) | |
# Show stats about the language per artist | |
df_raw_lyrics.groupby(['artist', 'lang']).size().reset_index() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment