Skip to content

Instantly share code, notes, and snippets.

@cpard
Created May 28, 2016 21:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cpard/e7cbcf55ab8fce99360fbf7fef292037 to your computer and use it in GitHub Desktop.
Save cpard/e7cbcf55ab8fce99360fbf7fef292037 to your computer and use it in GitHub Desktop.
Import Mailchimp Data with Python & Pandas
from sqlalchemy import create_engine
import pandas as padas
engine = create_engine('postgresql://USERNAME:PASSWORD@HOST:PORT/DATABASE)
joinedQuery = "select mailchimp_report_email_activity.email_address as email, merge_fields_lname as last_name, merge_fields_fname as first_name, action, timestamp from mailchimp_report_email_activity left join mailchimp_list_members on mailchimp_report_email_activity.email_address = mailchimp_list_members.email_address;"
joinedEventsFrame = padas.read_sql_query(joinedQuery, engine)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment