Created
October 6, 2016 12:00
-
-
Save jefferythewind/62e31a430f08a9cd00ee167522097902 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
sql_query = """ | |
SELECT main_user.id, age, gender, race, height, weight, drinks, tobacco, illegal_drugs, | |
prescription_drugs, network_size, likes, media, follows, followed_by, comments | |
FROM main_user | |
JOIN main_survey ON main_user.id = main_survey.id | |
JOIN ( | |
select | |
sum(likes) as likes, | |
sum(comments) as comments, | |
survey_id as id | |
from | |
main_instagrammedia | |
group by | |
survey_id | |
) media_totals | |
ON main_survey.id = media_totals.id; | |
""" | |
arradata = pd.read_sql(sql_query, engine) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment