Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- df = pd.read_csv('example.csv')
- table = df.to_html()
- msg = """<html>
- <style type = "text/css">
- table, th, td { border: 1px solid black; }
- </style>
- <head></head>
- <body>
- <p>some text</p>
- <div> %s </div>
- </body
- </html>""" % (table)
- from premailer import transform
- result = transform(msg)
- msg_body = MIMEText(result, 'html')
- msg.attach(msg_body)
- def styleTable(x):
- if x < 0:
- return 'background-color: red'
- else
- return ''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement