DH_Dashboard / app.py
imdskumar's picture
Rename sk_st.py to app.py
7c9067e
import pandas as pd # pip install pandas openpyxl
import plotly.express as px # pip install plotly-express
import streamlit as st # pip install streamlit
# emojis: https://www.webfx.com/tools/emoji-cheat-sheet/
st.set_page_config(page_title="Expense Dashboard", page_icon=":bar_chart:", layout="wide")
st.title("Expense Dashboard")
df= pd.read_csv("expense.csv")
st.sidebar.header("Please Filter Here:")
spender = st.sidebar.multiselect(
"Select the Spender:",
options=df["Spender_Name"].unique(),
default=df["Spender_Name"].unique()
)
st.sidebar.header("Please Filter Here:")
purpose = st.sidebar.multiselect(
"Select the Category:",
options=df["Main_Purpose"].unique(),
default=df["Main_Purpose"].unique()
)
df_selection = df.query(
"Spender_Name == @spender & Main_Purpose ==@purpose "
)
total_exp = df_selection.groupby(by=["Spender_Name"]).sum()
fig_exp = px.bar(total_exp,
template="plotly_white",
title="<b>Total Expense</b>",
)
total_amt = df_selection.groupby(by=["Main_Purpose"]).sum()
fig_amt = px.bar(total_amt,
template="plotly_white",
title="<b>Total Expense Category-Wise</b>",
)
left_column, right_column = st.columns(2)
left_column.plotly_chart(fig_exp, use_container_width=True)
right_column.plotly_chart(fig_amt, use_container_width=True)
# ---- HIDE STREAMLIT STYLE ----
hide_st_style = """
<style>
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
header {visibility: hidden;}
</style>
"""
st.markdown(hide_st_style, unsafe_allow_html=True)