Skip to content

Instantly share code, notes, and snippets.

@paulegan
Created October 16, 2018 19:03
Show Gist options
  • Save paulegan/0d7e484a23c2e652f85d07b93a57ace9 to your computer and use it in GitHub Desktop.
Save paulegan/0d7e484a23c2e652f85d07b93a57ace9 to your computer and use it in GitHub Desktop.
import sys
import numpy as np
import pandas as pd
df = pd.read_csv(sys.argv[1], dtype=str)
debaters = [(topic, set(df['Name'][df[topic] == 'Yes'])) for topic in df.columns[2:]]
np.random.shuffle(debaters)
attendees = set()
picked = set()
for topic, names in debaters:
attendees.update(names)
avail = names - picked
if len(avail) >= 2:
a, b = np.random.choice(list(avail), size=2, replace=False)
picked.update([a, b])
print("{:<30} {:>15} & {:<15}".format(topic, a, b))
print("Attendees ({}): {}".format(len(attendees), ", ".join(attendees)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment