Skip to content

Instantly share code, notes, and snippets.

@korakot
Created June 16, 2020 06:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save korakot/a3a9a062efaef1fe4667fd7a045b7039 to your computer and use it in GitHub Desktop.
Save korakot/a3a9a062efaef1fe4667fd7a045b7039 to your computer and use it in GitHub Desktop.
Count frequency using value_counts(), like a Counter. Display it as a proper dataframe.
(df.word.value_counts()
.rename_axis('word')
.reset_index(name='freq')
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment