Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataframe styler render in frontend is incorrect if table is wide #4958

Closed
PaleNeutron opened this issue Jul 12, 2022 · 1 comment
Closed
Labels
feature:st.dataframe type:bug Something isn't working

Comments

@PaleNeutron
Copy link
Contributor

Summary

Dataframe style render in frontend is incorrect if table is wide

Steps to reproduce

Code snippet:

import streamlit as st

import pandas as pd
from numpy import nan

data = [[ 1.49590318e-02,  4.13307241e-02,  2.96606754e-02,
         5.60946544e-02,  5.92372194e-02,  4.36623694e-02,
        -1.02449474e-02,  2.07244035e-02,  3.72137405e-03,
         4.83144943e-02, -3.00000000e-04,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan],
       [ 2.06085754e-02,  4.44958105e-02,  9.52843947e-03,
         5.60632508e-02,  5.20118823e-02,  4.36865840e-02,
        -7.88546502e-03,  2.01974097e-02, -1.42433911e-03,
         4.48240967e-02,  7.43796367e-02, -5.91264543e-03,
         3.08014942e-02, -6.18731275e-03,  1.22626582e-02,
        -1.24357054e-02, -4.02424545e-02,  1.17594993e-02,
         9.21834001e-02,  2.78211498e-02,  4.66498291e-02,
         2.24044961e-02,  1.93852570e-01,  6.05827483e-02,
         1.88106202e-02,  5.21961788e-03,  4.45427425e-02,
        -7.45354299e-03,  1.03156592e-02, -2.77749203e-03,
         4.44306675e-03,  2.22044605e-16, -1.91547583e-02,
        -1.28064032e-02],
       [ 1.57512116e-02,  4.28922429e-02,  3.02307080e-02,
         5.58185706e-02,  6.33322507e-02,  4.53233746e-02,
        -8.74978967e-03,  2.51854407e-02,  6.59836777e-03,
         4.54751747e-02,  7.85119922e-02, -8.05981744e-03,
         3.00060012e-02, -6.55802862e-03,  1.52325229e-02,
        -8.30332133e-03, -4.00000000e-04,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan],
       [ 1.53678771e-02,  4.34967714e-02,  3.02653703e-02,
         5.66198053e-02,  6.35885639e-02,  4.50759852e-02,
        -8.68158992e-03,  2.38779956e-02,  8.17079599e-03,
         4.64282431e-02,  7.60783538e-02, -9.60219479e-03,
         2.45959241e-02, -3.90000000e-03,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan],
       [ 1.52104107e-02,  4.09922590e-02,  2.46056782e-02,
         6.37583893e-02,  4.32086417e-02,  0.00000000e+00,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan,             nan,             nan,
                    nan]]


df = pd.DataFrame(data)
s = df.style.highlight_null()

st.dataframe(s)

st.table(s)

We could easily find that cells between column 1 to 3 are colored with red in st.dataframe but is correct in st.table

image

@PaleNeutron PaleNeutron added type:bug Something isn't working status:needs-triage Has not been triaged by the Streamlit team labels Jul 12, 2022
@LukasMasuch LukasMasuch added feature:st.dataframe and removed status:needs-triage Has not been triaged by the Streamlit team labels Jul 13, 2022
@LukasMasuch
Copy link
Collaborator

@PaleNeutron Thanks for reporting this problem. Closing this since the issue is fixed with the upcoming release (see related issue and PR). If the problem still appears with the next release, feel free to open the issue again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature:st.dataframe type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants