Reputation: 97
I am trying to export my correlation heatmap to excel. I can't find any documentation/syntax on this by 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
Upvotes: 2
Views: 2463
Reputation: 862601
You can chain both code together with .
:
(corr.style.background_gradient(cmap='coolwarm')
.to_excel("mev_corr_matrix.xlsx", engine="openpyxl"))
If need change precision
:
(corr.style.background_gradient(cmap='coolwarm')
.set_precision(2)
.to_excel("mev_corr_matrix.xlsx", engine="openpyxl"))
Upvotes: 5