使用python pandas将csv转换为html

Pet*_*hao 4 html python csv pandas

我有一个csv文件,需要转换为HTML格式.我知道python pandas可以做到DataFormat.to_html(),但无法弄清楚放在()中的值.我有:

pd.DataFrame.to_html(class=myfile.csv) 
Run Code Online (Sandbox Code Playgroud)

但是有问题.有人有想法吗?

Ant*_*pov 7

你需要把数据帧放在那里:

df = pd.read_csv("myfile.csv")
df.to_html('your_file.html')
Run Code Online (Sandbox Code Playgroud)