Skip to content

Instantly share code, notes, and snippets.

@hute37
Forked from aniruddha27/GroupBy_filter.py
Created June 15, 2020 09:08
Show Gist options
  • Save hute37/b09573e541a20223513584705c043c96 to your computer and use it in GitHub Desktop.
Save hute37/b09573e541a20223513584705c043c96 to your computer and use it in GitHub Desktop.
def filter_func(x):
return x['Item_Weight'].std() < 3
df_filter = df.groupby(['Item_Weight']).filter(filter_func)
df_filter.shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment