Skip to content

Instantly share code, notes, and snippets.

@piEsposito
Created April 28, 2020 17:17
Show Gist options
  • Save piEsposito/dd7c2515bd7d739a82180fb0720d4dbd to your computer and use it in GitHub Desktop.
Save piEsposito/dd7c2515bd7d739a82180fb0720d4dbd to your computer and use it in GitHub Desktop.
idx_positive = df[df['labels']=='positive'].index
nbr_to_drop = len(df) - len(idx_positive)
drop_indices = np.random.choice(idx_positive, nbr_to_drop, replace=False)
df = df.drop(drop_indices)
#transform all of it to lists
text_as_list = df['text'].tolist()
labels_as_list = df['labels'].tolist()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment