[Python] Pandas Styler.bar() not showing on Excel column

Discussão em 'Python' iniciado por Stack, Agosto 24, 2025.

  1. Stack

    Stack Membro Participativo

    I'm working on a default style for some reports I have to do. I'd like to add the Styler.bar() method.

    Sample of the dataset used for integration:

    symbol,date,open,high,low,close,volume
    AAL,2014-01-02,25.07,25.82,25.06,25.36,8998943
    AAPL,2014-01-02,79.3828,79.5756,78.8601,79.0185,58791957
    AAP,2014-01-02,110.36,111.88,109.29,109.74,542711
    ABBV,2014-01-02,52.12,52.33,51.52,51.98,4569061
    ABC,2014-01-02,70.11,70.23,69.48,69.89,1148391
    ABT,2014-01-02,38.09,38.4,38,38.23,4967472
    ACN,2014-01-02,81.5,81.92,81.09,81.13,2405384
    ADBE,2014-01-02,59.06,59.53,58.94,59.29,2746370
    ADI,2014-01-02,49.52,49.75,49.04,49.28,2799092


    If I test it in a Jupyter notebook works just fine but when I try to export it to Excel file, the columns do not change.

    import pandas as pd

    df = pd.read_csv('./sp500.csv')

    styler = df.style

    styler.bar(subset=['close'], color='#6399ae',
    vmin=0, vmax=df['close'].max())


    There is no that much documentation about Styler nor this method and I fear that there is something superbasic that I'm missing on.

    styler.to_excel('./sp500.csv', index=False)

    Continue reading...

Compartilhe esta Página