How do I add tooltip to column in a dataframe using streamlit?
If I run this example:python - How to annotate labels when you hover over a pandas dataframe - Stack Overflow
import pandas as pd
foo = pd.DataFrame({
'temp': ['message1', 'message2', 'message3'],
'var2': [1, 2, 3],
'col3': [4, 5, 6]
})
# Setup a DataFrame with corresponding hover values
tooltips_df = pd.DataFrame({
'temp': ['i am message 1', 'i am foo', 'i am lala'],
'var2': ' another random message',
'col3': 'more random messages'
})
# Assign tooltips
foo.style.set_tooltips(tooltips_df)
t = st.empty()
t.dataframe( foo.style.set_tooltips(tooltips_df) )
then I get error: βintβ object has no attribute βstripβ
from:
File "../venv/lib/python3.8/site-packages/streamlit/elements/arrow.py", line 314, in _pandas_style_to_css
declaration = css_property.strip() + ": " + css_value.strip()