-1

I wrote a code that converts a dataframe to html and emails it. I need to union/append this table with another table(one on top of another). Can someone please help me figure out how I would do that?

Here is my code:

# 'dataset' holds the input data for this script import pandas

from email.mime.text import MIMEText from email.mime.application import MIMEApplication from email.mime.multipart import MIMEMultipart from smtplib import SMTP import smtplib import sys

msg = MIMEMultipart() msg['Subject'] = "Daily Report" msg['From'] = 'MM@gmail.com'


html = """\ <html>   <head></head>   <body>
    {0}   </body> </html> "Name" """.format(pandas.DataFrame(dataset).to_html())


part1 = MIMEText(html, 'html') msg.attach(part1)

server = smtplib.SMTP_SSL("smtp.gmail.com",465) server.login('MM@gmail.com', 'pythontest') server.sendmail("Sender@gmail.com","Receiver@python.com",msg.as_string()) server.quit()*
  • Does this answer your question? [How do I combine two dataframes?](https://stackoverflow.com/questions/12850345/how-do-i-combine-two-dataframes) – esqew Dec 25 '20 at 05:17

1 Answers1

0

You can concatenate the tables using pandas and then use the result of concatenation in the email. Please see the link for pandas concat https://pandas.pydata.org/pandas-docs/stable/user_guide/merging.html

CTUDEV
  • 23
  • 4