Python Forum

Full Version: Unknown characters in output using to_html
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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 ?
please show one of the lines that has the unknown text (complete line, unaltered)
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.