Skip to content

Instantly share code, notes, and snippets.

@goddoe
Created May 16, 2020 01:13
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 goddoe/dcd3782ba9e75d836ebb363654251787 to your computer and use it in GitHub Desktop.
Save goddoe/dcd3782ba9e75d836ebb363654251787 to your computer and use it in GitHub Desktop.
sample each group
data_df = data_df.groupby('label', group_keys=False).apply(pd.DataFrame.sample, n=50, replace=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment