Skip to content

Instantly share code, notes, and snippets.

@jonathanoheix
Created December 18, 2018 09:50
Show Gist options
  • Save jonathanoheix/13dcb8aaa0f3ad54393b5d8d399dcef6 to your computer and use it in GitHub Desktop.
Save jonathanoheix/13dcb8aaa0f3ad54393b5d8d399dcef6 to your computer and use it in GitHub Desktop.
# add number of characters column
reviews_df["nb_chars"] = reviews_df["review"].apply(lambda x: len(x))
# add number of words column
reviews_df["nb_words"] = reviews_df["review"].apply(lambda x: len(x.split(" ")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment