【问题标题】:Export Correlation Heatmap to Excel将相关热图导出到 Excel
【发布时间】:2019-07-11 08:18:00
【问题描述】:

我正在尝试将我的相关热图导出到 Excel。我在 python 上找不到任何文档/语法


corr.style.background_gradient(cmap='coolwarm').set_precision(2)

corr.style. \
    apply(background_gradient, axis=None).\
    to_excel("mev_corr_matrix.xlsx", engine="openpyxl")



I want to export the heatmap as is to excel

【问题讨论】:

    标签: python python-3.x pandas jupyter correlation


    【解决方案1】:

    您可以将这两个代码与. 链接在一起:

    (corr.style.background_gradient(cmap='coolwarm')
               .to_excel("mev_corr_matrix.xlsx", engine="openpyxl"))
    

    如需更改precision:

    (corr.style.background_gradient(cmap='coolwarm')
               .set_precision(2)
               .to_excel("mev_corr_matrix.xlsx", engine="openpyxl"))
    

    【讨论】:

      猜你喜欢
      • 2017-10-11
      • 1970-01-01
      • 2017-11-22
      • 2011-11-21
      • 2019-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多