Last active
August 29, 2015 13:57
-
-
Save ruescasd/9874233 to your computer and use it in GitHub Desktop.
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
for question in data['result']['counts']: | |
if "APPROVAL" not in question['a']: | |
continue | |
women = [a for a in question['answers'] if a['value'] in women_names] | |
men = [a for a in question['answers'] if a['value'] not in women_names] | |
answers_sorted = [] | |
if women[0]['value'] == question['answers'][0]['value']: | |
men.insert(0, None) | |
for man, woman in zip_longest(men, women): | |
if man is not None: | |
answers_sorted.append(man) | |
if woman is not None: | |
answers_sorted.append(woman) | |
question['answers'] = answers_sorted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment