if not st.session_state.df.empty:
st.subheader(“Query Results”, anchor=False)
st.dataframe(st.session_state.df)
st.subheader("Chart Visualization:", anchor=False)
col1, col2 = st.columns(2)
with col1:
chart_type = st.selectbox("Select Chart Type", ['Bar Chart', 'Line Chart', 'Pie Chart', 'Scatter Chart'])
with col2:
x_col = st.selectbox("Select X-axis Column", st.session_state.df.columns)
y_col = st.selectbox("Select Y-axis Column", st.session_state.df.columns)
fig = plot_data(st.session_state.df, chart_type, x_col, y_col)
if fig:
st.plotly_chart(fig)
else:
st.write(“No results found for the given query. Try
another input…”)