Peter Chao
Peter Chao

Reputation: 443

use python pandas convert csv to html

I have a csv file and need to convert to html format. I know python pandas can do it with DataFormat.to_html(), but could not figure out what value to put in the (). I have:

pd.DataFrame.to_html(class=myfile.csv) 

but got issue with it. Anyone has idea?

Upvotes: 4

Views: 5130

Answers (2)

Felix
Felix

Reputation: 1579

You can put path where you want to save file including file name. Example: DF.to_html ("C:/desktop/test.html")

Upvotes: 0

Anton Protopopov
Anton Protopopov

Reputation: 31692

You need to put there dataframe:

df = pd.read_csv("myfile.csv")
df.to_html('your_file.html')

Upvotes: 9

Related Questions