Created
April 7, 2020 19:44
-
-
Save jerpint/f1945ac281bfc7186d777e819be13ca2 to your computer and use it in GitHub Desktop.
Extract questions and anwers from healthtap dataset
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
import ast | |
import pandas as pd | |
data = pd.read_csv('path_to_healthtap_file.csv') | |
all_questions = [] | |
all_answers = [] | |
for question, answer_format in zip(data.question, data.answers): | |
try: | |
if answer_format != "[]": | |
all_answers.append(ast.literal_eval(answer_format)[0]["answer"]) | |
all_questions.append(question) | |
except: | |
continue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment