Python Forum
Unknown characters in output using to_html
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unknown characters in output using to_html
#1
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 ?
Reply
#2
please show one of the lines that has the unknown text (complete line, unaltered)
Reply
#3
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Remove escape characters / Unicode characters from string DreamingInsanity 5 13,420 May-15-2020, 01:37 PM
Last Post: snippsat
  Unknown output brzo 3 3,791 Jun-24-2017, 04:16 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020