Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -200,23 +200,15 @@ if viz_button:
|
|
| 200 |
# Display expenses over time
|
| 201 |
st.subheader("Expenses Over Time")
|
| 202 |
|
| 203 |
-
# Copy DataFrame to not modify the original
|
| 204 |
-
#monthly_df = st.session_state['expenses'].copy()
|
| 205 |
-
|
| 206 |
-
# Convert 'Date' column to datetime format for plotting
|
| 207 |
-
#monthly_df['Date'] = pd.to_datetime(monthly_df['Date'])
|
| 208 |
-
|
| 209 |
-
# Sort the DataFrame by 'Date'
|
| 210 |
-
#monthly_df = monthly_df.sort_values(by = 'Date')
|
| 211 |
-
|
| 212 |
# Group by 'Category' and sum the 'Amount'
|
| 213 |
date_group = st.session_state['expenses'].groupby('Date')['Amount'].sum().reset_index()
|
| 214 |
|
|
|
|
|
|
|
| 215 |
# Extract dates and expenses for plotting
|
| 216 |
dates = date_group['Date']
|
| 217 |
expenses = date_group['Amount']
|
| 218 |
|
| 219 |
-
|
| 220 |
# Create a line plot
|
| 221 |
fig, ax = plt.subplots()
|
| 222 |
|
|
|
|
| 200 |
# Display expenses over time
|
| 201 |
st.subheader("Expenses Over Time")
|
| 202 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
# Group by 'Category' and sum the 'Amount'
|
| 204 |
date_group = st.session_state['expenses'].groupby('Date')['Amount'].sum().reset_index()
|
| 205 |
|
| 206 |
+
date_group = date_group.sort_values(by='Date')
|
| 207 |
+
|
| 208 |
# Extract dates and expenses for plotting
|
| 209 |
dates = date_group['Date']
|
| 210 |
expenses = date_group['Amount']
|
| 211 |
|
|
|
|
| 212 |
# Create a line plot
|
| 213 |
fig, ax = plt.subplots()
|
| 214 |
|