Created
November 25, 2020 17:19
-
-
Save rrosasl/8f8d3dd353aa769e211f038adfa5b206 to your computer and use it in GitHub Desktop.
FIrst round of voting
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Create Data Frame where results will be stored | |
results = [] | |
vote_rounds = pd.DataFrame() | |
df_t = df.transpose() # Change rows and columns to have voters as columns | |
for col in df_t.columns: | |
top_choice = df_t[col].min() #Choose their Top Canidate | |
top_candidate = df_t[df_t[col] == top_choice].index.tolist()[0] | |
results.append(top_candidate) | |
vote_rounds[0] = results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment