Build And Deploy An Interactive Sales Dashboard With Streamlit

???? Why Streamlit?
Streamlit is a powerful open-source Python library that turns data scripts into shareable web apps in minutes. It is perfect for data science and machine learning projects.
???? Features of This Project
- Display data in table format
- Create a line chart for monthly sales
- Deploy the dashboard to the web with zero configuration
???? Prerequisites
- Basic knowledge of Python
-
streamlit
,pandas
, andmatplotlib
installed (pip install streamlit pandas matplotlib
) - A GitHub account
- A Streamlit Cloud account
???????? Full Code (app.py
)
import streamlit as st
import pandas as pd
import matplotlib.pyplot as plt
# Title
st.title("Sales Dashboard")
# Sample Data
data = {
"Month": ["Jan", "Feb", "Mar", "Apr", "May"],
"Sales": [1500, 1800, 2400, 3000, 2800]
}
df = pd.DataFrame(data)
# Show table
st.subheader("Sales Data")
st.dataframe(df)
# Line chart
st.subheader("Sales Line Chart")
plt.plot(df["Month"], df["Sales"], marker='o')
plt.xlabel("Month")
plt.ylabel("Sales")
plt.grid(True)
st.pyplot(plt)
Explanation:
-
st.title
,st.subheader
, andst.dataframe
are used to structure the page layout. -
matplotlib.pyplot
is used to generate the line chart. -
st.pyplot
directly displays the Matplotlib figure inside the Streamlit app.
???? How to Deploy to the Cloud
- Push your
app.py
file to a GitHub repository. - Create a free account on Streamlit Cloud.
- Click on New App and connect your GitHub repository.
- Select your branch and main file (
app.py
). - Click Deploy.
???? Your app will be instantly live and ready to share!
???? Conclusion
Streamlit makes it incredibly easy for Python developers to build beautiful, interactive dashboards and professional reports.
Whether you are creating a quick data visualization prototype or a full business intelligence solution, Streamlit offers the flexibility and speed to bring your ideas to life.
If you are looking to transform your data into powerful web applications with minimal effort, Streamlit is definitely a tool worth exploring!
The source code and the automated deployment workflow for Streamlit Cloud can be found here:
???? https://github.com/dennisdhm7/Streamlit.git