Skip to content

Instantly share code, notes, and snippets.

@jxramos
Created June 2, 2025 19:09
Show Gist options
  • Save jxramos/8b08fcf96b19127dd7bfbf301ee29757 to your computer and use it in GitHub Desktop.
Save jxramos/8b08fcf96b19127dd7bfbf301ee29757 to your computer and use it in GitHub Desktop.
pandas notes

Apply group size count to each record

df['colX_count']= df.colX.map(df.colX.value_counts())

source https://stackoverflow.com/a/55576813/1330381 great for pairing log records that appear in groups of a known size you wish to filter on by the group size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment