【问题标题】:How to merge cells in HTML output of pandas dataframe in Python如何在 Python 中合并 pandas dataframe 的 HTML 输出中的单元格
【发布时间】:2023-01-25 19:52:38
【问题描述】:

如何合并以下熊猫数据框

转换为以下 HTML 格式?

【问题讨论】:

    标签: python-3.x pandas dataframe


    【解决方案1】:
    import pandas as pd
    from IPython.display import HTML
    
    result = {}.to_html # replace the brackets with the variable of your dataframe
    print(result)
    
    # If you want the HTML output in a file:
    f = open('index.html', 'w')
    f.write(result)
    f.close()
    

    【讨论】:

      猜你喜欢
      • 2019-12-04
      • 1970-01-01
      • 2014-04-04
      • 1970-01-01
      • 2016-05-12
      • 2016-12-26
      • 2017-11-01
      • 2018-05-29
      • 2020-02-13
      相关资源
      最近更新 更多