Advertisement
Guest User

Untitled

a guest
Jun 29th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. df = pd.read_csv('example.csv')
  2. table = df.to_html()
  3.  
  4. msg = """<html>
  5. <style type = "text/css">
  6. table, th, td { border: 1px solid black; }
  7. </style>
  8. <head></head>
  9. <body>
  10. <p>some text</p>
  11. <div> %s </div>
  12. </body
  13. </html>""" % (table)
  14.  
  15. from premailer import transform
  16. result = transform(msg)
  17.  
  18. msg_body = MIMEText(result, 'html')
  19. msg.attach(msg_body)
  20.  
  21. def styleTable(x):
  22. if x < 0:
  23. return 'background-color: red'
  24. else
  25. return ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement