【问题标题】:use python pandas convert csv to html使用 python pandas 将 csv 转换为 html
【发布时间】:2016-10-03 01:41:09
【问题描述】:

我有一个 csv 文件,需要转换为 html 格式。我知道 python pandas 可以用DataFormat.to_html() 做到这一点,但无法弄清楚在 () 中放入什么值。我有:

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

但有问题。 有人知道吗?

【问题讨论】:

    标签: python html csv pandas


    【解决方案1】:

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

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

    【讨论】:

      【解决方案2】:

      您可以将路径放在要保存文件的位置,包括文件名。 例子: DF.to_html("C:/desktop/test.html")

      【讨论】:

        猜你喜欢
        • 2021-03-10
        • 2019-07-27
        • 2017-09-12
        • 2019-03-15
        • 2021-12-26
        • 2019-07-05
        • 1970-01-01
        • 2021-04-26
        • 2017-06-10
        相关资源
        最近更新 更多