Converting a csv file into html file using pandas file.to_html command in pycharm?

0 votes

Hello guys, I am having some problems with my code and would appreciate any help. 

I am trying to convert a csv file into html using pandas in latest version of pycharm and python 3.5.0 but i am getting unicode encode error. I added the encoding="ISO-8859-1" but still comes with error.

 import pandas as 

pd injury = pd.read_csv('C:\\Users\\Apple\\Desktop\\injury1.csv', encoding="ISO-8859-1",index_col=0) 

 injury.to_html('injury.html')

output

UnicodeEncodeError: 'charmap' codec can't encode character '\x96' in position 34433: character maps to <undefined>

Thanks in advance. 

Aug 24 in Python by anonymous
16 views
Did you try "utf-8" coding?

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Python

0 votes
0 answers

Storing a list of arrays into a CSV file and retrieving it back in a different program

This is the code that I am ...READ MORE

Jun 6, 2018 in Python by ariaholic
• 7,340 points
40 views
0 votes
2 answers

How to check if a csv file is empty in pandas?

Try this: df = pd.DataFrame(columns=['Name', 'ID', 'Department']) if df.empty ...READ MORE

answered Jul 1 in Python by Bob
257 views
+2 votes
2 answers

How can I replace values with 'none' in a dataframe using pandas

Actually in later versions of pandas this ...READ MORE

answered Aug 13, 2018 in Python by bug_seeker
• 15,350 points
5,788 views
0 votes
1 answer

How can I convert a list of dictionaries from a CSV into a JSON object in Python?

You could try using the AST module. ...READ MORE

answered Apr 17, 2018 in Python by anonymous
679 views
0 votes
1 answer

I'm using Python 2.7 to convert an XML response (from a REST call to Atlassian Fisheye) into an HTML table.

You don't have a template matching tabularQueryResult in your ...READ MORE

answered Oct 4, 2018 in Python by Priyaj
• 56,540 points
34 views
0 votes
1 answer

In Python, how do I read a file line-by-line into a list?

with open(fname) as f:     content = f.readlines() # you ...READ MORE

answered Oct 9, 2018 in Python by SDeb
• 13,160 points
114 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 236 views