engralimalik commited on
Commit
3c13623
·
verified ·
1 Parent(s): 8959e5f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -71,7 +71,9 @@ if uploaded_file:
71
  df_filtered['Month'] = df_filtered['Date'].dt.to_period('M').astype(str) # Convert Period to string for Plotly compatibility
72
  monthly_expenses = df_filtered.groupby('Month')['Amount'].sum()
73
 
74
- fig2 = px.line(monthly_expenses, x=monthly_expenses.index, y=monthly_expenses.values, title="Monthly Expenses", labels={"x": "Month", "y": "Amount ($)"})
 
 
75
  st.plotly_chart(fig2)
76
 
77
  # 3. Monthly Spending vs Budget (Bar Chart)
 
71
  df_filtered['Month'] = df_filtered['Date'].dt.to_period('M').astype(str) # Convert Period to string for Plotly compatibility
72
  monthly_expenses = df_filtered.groupby('Month')['Amount'].sum()
73
 
74
+ # Convert monthly_expenses into DataFrame for correct plotting
75
+ monthly_expenses_df = monthly_expenses.reset_index()
76
+ fig2 = px.line(monthly_expenses_df, x='Month', y='Amount', title="Monthly Expenses", labels={"Month": "Month", "Amount": "Amount ($)"})
77
  st.plotly_chart(fig2)
78
 
79
  # 3. Monthly Spending vs Budget (Bar Chart)