Styling of column and row headers not reflected when saving to excel. · Issue #25185 · pandas-dev/pandas (original) (raw)
Following is the code I used to style the headers of both rows and columns and then saving the stylized data frame to an excel file.
df = pd.DataFrame([1000000.0, 1000000.0], index=pd.bdate_range('2017-08-01', '2017-08-02'))
df.index = df.index.strftime("%Y-%m-%d") styler = df.style styler.set_table_styles(
select the table header with th and set it right align
[dict(selector="th", props=[("text-align", "right"),('color','green')])]
) styler.to_excel('styled.xlsx', engine='openpyxl')
Problem description
I am trying to stylize the headers of a data frame and then save that data frame to an excel file, but I am unable to see the stylized effects inside the excel file.
Output of Jupyter Notebook
Output in excel file
Expected Output
Pandas Version: '0.24.1'