Streamlit not hiding dataframe column

I want to hide a column of a pandas dataframe but Streamlit shows all the columns.

import numpy as np
import pandas as pd
import streamlit as st

df = pd.DataFrame(np.random.randn(3,4), columns=['A','B','C','D'])
st.dataframe(df.style.hide(["A"], axis="columns"))

Screen Shot 2022-09-08 at 3.54.48 PM

Hi @arkajyo,

Try styling the DataFrame/hiding the column before you pass it to st.dataframe, rather than doing it all in one line

Hi @Caroline ,

I tried the following but got the same result:

import numpy as np
import pandas as pd
import streamlit as st

df = pd.DataFrame(np.random.randn(3,4), columns=['A','B','C','D'])
df = df.style.hide(["A"], axis="columns")
st.dataframe(df)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.