alidenewade commited on
Commit
be53cf8
·
verified ·
1 Parent(s): 1557c65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -14
app.py CHANGED
@@ -138,22 +138,8 @@ def create_time_series_plot(metric, start_date, end_date):
138
 
139
  filtered_df = panel_df[(panel_df['month'] >= start_date) & (panel_df['month'] <= end_date)]
140
 
141
- if len(filtered_df) == 0:
142
- fig, ax = plt.subplots(figsize=(12, 6))
143
- ax.text(0.5, 0.5, f"No data found for date range\n{start_date.date()} to {end_date.date()}",
144
- ha='center', va='center', fontsize=12)
145
- ax.set_title('No Data Available', fontsize=15)
146
- return fig
147
-
148
  monthly_totals = filtered_df.groupby('month')[metric].sum()
149
 
150
- if len(monthly_totals) == 0 or monthly_totals.sum() == 0:
151
- fig, ax = plt.subplots(figsize=(12, 6))
152
- ax.text(0.5, 0.5, f"No {metric.replace('_', ' ').title()} data for selected period",
153
- ha='center', va='center', fontsize=12)
154
- ax.set_title('No Data Available', fontsize=15)
155
- return fig
156
-
157
  fig, ax = plt.subplots(figsize=(12, 6))
158
  monthly_totals.plot(ax=ax)
159
  ax.set_title(f'Monthly Total of {metric.replace("_", " ").title()}', fontsize=15)
 
138
 
139
  filtered_df = panel_df[(panel_df['month'] >= start_date) & (panel_df['month'] <= end_date)]
140
 
 
 
 
 
 
 
 
141
  monthly_totals = filtered_df.groupby('month')[metric].sum()
142
 
 
 
 
 
 
 
 
143
  fig, ax = plt.subplots(figsize=(12, 6))
144
  monthly_totals.plot(ax=ax)
145
  ax.set_title(f'Monthly Total of {metric.replace("_", " ").title()}', fontsize=15)