while plotting the line chart, is it default setting in streamlit that it takes the browser timezone information, even if the dataframe is in to different timezone.
i created a dashboard using streamlit, pandas, and plotly. when i run the code in vs code, it displays the full dashboard with all the data. however, when i deploy it on streamlit share, the dashboard or some charts are not fully visible.
Happy to help! Try this documentation: docs.streamlit.io/develop/tutorials/databases/postgresql If you still run into questions, please let us know on the forum! discuss.streamlit.io/
athane le code pour postgresql: import streamlit as st import psycopg2 import pandas as pd import matplotlib.pyplot as plt # Connect to the PostgreSQL database conn = psycopg2.connect(dbname="dbname", user="youruser", password="yourpassword", host="localhost") # Allow user to select data to visualize table = st.selectbox("Select table", ["billions", "countries"]) # Write a function to query data from the table @st.cache_resource def load_data(table): cur = conn.cursor() cur.execute(f"SELECT * FROM {table}") rows = cur.fetchall() cur.close() return rows # Load data into a pandas DataFrame rows = load_data(table) df = pd.DataFrame(rows, columns=["country_id", "country"]) # Replace with actual column names # Create a bar chart plt.figure(figsize=(8, 6)) plt.bar(df["country_id"], df["country"]) plt.xlabel("X-axis label") plt.ylabel("Y-axis label") plt.title("Bar Chart") st.pyplot(plt) # Close the database connection conn.close()
I like DataProfessor. I would like more videos from him:) Like this video)
Thanks Dmitry for the support :)
Streamlit ois indeed a powerfull tool !
while plotting the line chart, is it default setting in streamlit that it takes the browser timezone information, even if the dataframe is in to different timezone.
i created a dashboard using streamlit, pandas, and plotly. when i run the code in vs code, it displays the full dashboard with all the data. however, when i deploy it on streamlit share, the dashboard or some charts are not fully visible.
Does this support VPython? if so can you make a video about that
Good video on streamlit. Is it possible to drill down and drill across on a chart in streamlit? Grt if there is any document. Thanks
I suppose you could use the highcharts library?
Thanks a lot for this video. Could you please show how to deploy a Streamlit app that connects to a PostgreSQL database?
Happy to help! Try this documentation: docs.streamlit.io/develop/tutorials/databases/postgresql
If you still run into questions, please let us know on the forum! discuss.streamlit.io/
athane le code pour postgresql:
import streamlit as st
import psycopg2
import pandas as pd
import matplotlib.pyplot as plt
# Connect to the PostgreSQL database
conn = psycopg2.connect(dbname="dbname", user="youruser", password="yourpassword", host="localhost")
# Allow user to select data to visualize
table = st.selectbox("Select table", ["billions", "countries"])
# Write a function to query data from the table
@st.cache_resource
def load_data(table):
cur = conn.cursor()
cur.execute(f"SELECT * FROM {table}")
rows = cur.fetchall()
cur.close()
return rows
# Load data into a pandas DataFrame
rows = load_data(table)
df = pd.DataFrame(rows, columns=["country_id", "country"]) # Replace with actual column names
# Create a bar chart
plt.figure(figsize=(8, 6))
plt.bar(df["country_id"], df["country"])
plt.xlabel("X-axis label")
plt.ylabel("Y-axis label")
plt.title("Bar Chart")
st.pyplot(plt)
# Close the database connection
conn.close()
what about how to use database to save data and retrieve
Considering recent events. It might be better to distance Streamlit from Snowflake.