Skip to content

Instantly share code, notes, and snippets.

@focaalvarez
Created July 11, 2019 12:09
Show Gist options
  • Save focaalvarez/dfd54673f6fbb74619884ad2dd9fd696 to your computer and use it in GitHub Desktop.
Save focaalvarez/dfd54673f6fbb74619884ad2dd9fd696 to your computer and use it in GitHub Desktop.
#count words in names
pubs['word_count'] = pubs['name'].apply(lambda x: len(str(x).split(" ")))
pubs.hist(column=['word_count'],grid=False,bins=10)
print('The average lenght of the Pub names is ',str(pubs['word_count'].mean()),' words.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment