I am trying to send outlook mail via python. I import some data from excel files using dataframe and after some filtering I send them where the body of the mail is:
body = '<html><body>'+df.to_html()+'</body></html>'
I get a table but the cells are not aligned.I can not use justify='left/write' as I want the cells to be center aligned,not just the column headers. I have used styles but it did not work either:
df.style.set_properties(subset=df.columns,**{'width':'10em', 'text-align':'center'})\
I tried this too and it did not work.
p=HTML(df.to_html(classes= 'table text-align:center'))
After surfing through similar problems I found another solution:
s = df.style.set_properties(**{'text-align': 'center'})
s.render()
However it makes the border of the table disappear.So I modified it:
s = df.style.set_properties(**{'text-align': 'center','border-color':'Black','border-width':'thin','border-style':'dotted'})
This gives border to the cells. But it looks like each cell is inside individual textbox,not like a table. How do I get this done?

