Hi, streamlit newbie here, I’m having trouble having my first app displaying anything with a line_chart. I’m using streamlit in Snowflake. Here’s my use case:
- read some data from a Snowflake table (looks ok)
- extract relevant columns from the results returned from the select (a timestamp and a numerical column (also looks ok)
- plot numerical values vs timestamp
the final step either shows nothing, some axis labels with no data, or (if I include just the numerical data, no timestamps), values totally unrelated to the data in the table.
Code looks like this:
st.set_page_config(layout="wide")
# Get current session
session = get_active_session()
@st.cache_data()
def load_data():
# Load and transform daily stock price data.
# football_prices = (
# session.table("DB_MARKETPLACE.PRICING_FOOTBALL_WORLDCUP_2022.PRICING")
# )
query=f"select * from <snowflake table name> limit 20"
data = pd.DataFrame(session.sql(query).collect())
return data
fdata = load_data()
st.dataframe(fdata)
chart_data = pd.DataFrame(fdata, columns=["PRICE"])
st.dataframe(chart_data)
st.line_chart(chart_data, y="PRICE", use_container_width=True)
the above code produces the results where the numbers are nothing like the data!
I’m expecting a range between 0.0 and 400.0, I’m getting values like those shown in the clip shown below
Any suggestions to what is going on and what I can change?
Thanks!