Send pandas dataframe data as html e-mail
Finally found. This is the way it should be done.
filename = "test.html"
f = file(filename)
attachment = MIMEText(f.read(),'html')
msg.attach(attachment)
Pandas has a function for this.
This will give the the html code for the table, after which you can embed it into an email with:
df = DataFrame(data)
email = " some html {df} lah lah"
email = email.format(df=df.to_html())