CoolFace
Apppublic

imdskumar/DH_Dashboard

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py69 linesDownload Raw Back to root
1 2import pandas as pd  # pip install pandas openpyxl3import plotly.express as px  # pip install plotly-express4import streamlit as st  # pip install streamlit5 6# emojis: https://www.webfx.com/tools/emoji-cheat-sheet/7st.set_page_config(page_title="Expense Dashboard", page_icon=":bar_chart:", layout="wide")8st.title("Expense Dashboard")9df= pd.read_csv("expense.csv")10 11 12st.sidebar.header("Please Filter Here:")13spender = st.sidebar.multiselect(14    "Select the Spender:",15    options=df["Spender_Name"].unique(),16    default=df["Spender_Name"].unique()17)18 19 20st.sidebar.header("Please Filter Here:")21purpose = st.sidebar.multiselect(22    "Select the Category:",23    options=df["Main_Purpose"].unique(),24    default=df["Main_Purpose"].unique()25)26 27 28df_selection = df.query(29    "Spender_Name == @spender & Main_Purpose ==@purpose "30)31 32 33 34 35 36 37total_exp = df_selection.groupby(by=["Spender_Name"]).sum()38 39fig_exp = px.bar(total_exp,40   template="plotly_white",41   title="<b>Total Expense</b>",42 43)44 45total_amt = df_selection.groupby(by=["Main_Purpose"]).sum()46 47fig_amt = px.bar(total_amt,48   template="plotly_white",49   title="<b>Total Expense Category-Wise</b>",50 51)52 53left_column, right_column = st.columns(2)54left_column.plotly_chart(fig_exp, use_container_width=True)55right_column.plotly_chart(fig_amt, use_container_width=True)56 57 58# ---- HIDE STREAMLIT STYLE ----59hide_st_style = """60            <style>61            #MainMenu {visibility: hidden;}62            footer {visibility: hidden;}63            header {visibility: hidden;}64            </style>65            """66st.markdown(hide_st_style, unsafe_allow_html=True)67 68 69