A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pandas-dev/pandas/issues/25185 below:

Styling of column and row headers not reflected when saving to excel. · Issue #25185 · pandas-dev/pandas · GitHub

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'


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4