Python Forum
Unknown characters in output using to_html - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Unknown characters in output using to_html (/thread-25121.html)



Unknown characters in output using to_html - Kishore01 - Mar-20-2020

I am using python "to_html" function to convert csv data into html format to be sent in email:
df= pd.read_csv(filename,names=columns,index_col=0)
with open('final.html','w') as f:
     print(df.to_html(),file=f)
I am getting some unknown text like "ISO 9075" appended to the end of last column text values in some rows
, which is not part of the originalcsv file.Any ideawhy I am seeing this and howto eliminate this
junk text characters ?


RE: Unknown characters in output using to_html - Larz60+ - Mar-20-2020

please show one of the lines that has the unknown text (complete line, unaltered)


RE: Unknown characters in output using to_html - scidam - Mar-20-2020

I suspect this is because you lost base tags, such as html, head, body, and, most important, <meta charset="utf-8">. .to_html method produces a table only.