Skip to content

Instantly share code, notes, and snippets.

@AyishaR
Created January 16, 2021 17:10
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 AyishaR/74605dafb138bac1b85e882132e29257 to your computer and use it in GitHub Desktop.
Save AyishaR/74605dafb138bac1b85e882132e29257 to your computer and use it in GitHub Desktop.
# Spltting into one dataframe for each category.
df_1 = df[df['class'] == 1]
df_2 = df[df['class'] == 2]
# Resampling
df_2 = df_2.sample(len(df_1), replace = True)
# Concatenating the two to form a single dataset
df = df_2.append(df_1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment