yk07577 commited on
Commit
accafcf
·
verified ·
1 Parent(s): 293b7f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -189,14 +189,9 @@ def handle_custom_question(question):
189
  lowest_year = liabilities_by_year.idxmin()
190
  lowest_value = liabilities_by_year.min()
191
  return f"The year with the least amount of liabilities was {lowest_year} with ${lowest_value:,.2f}.", None
192
- if "assets" in q and "graph" in q:
193
- assets = df[df["tlabel"].astype(str).str.contains("total assets", case=False, na=False)]
194
- grouped = assets.groupby("quarter")["value"].sum().sort_index().tail(8)
195
- fig, ax = plt.subplots()
196
- grouped.plot(kind="bar", ax=ax)
197
- ax.set_title("Total Assets by Quarter (Last 2 Years)")
198
- ax.set_ylabel("USD ($)")
199
- return "Here is the total assets by quarter for the last 2 years.", to_img(fig)
200
 
201
  # === Free Cash Flow trend (last 8 quarters) ===
202
  if "free cash flow" in question.lower() or "fcf" in question.lower():
 
189
  lowest_year = liabilities_by_year.idxmin()
190
  lowest_value = liabilities_by_year.min()
191
  return f"The year with the least amount of liabilities was {lowest_year} with ${lowest_value:,.2f}.", None
192
+ if "asset" in q and ("graph" in q or "plot" in q or "quarter" in q):
193
+ image = plot_assets_by_quarter_last_two_years()
194
+ return "Here is the total assets by quarter for the last 2 years.", image
 
 
 
 
 
195
 
196
  # === Free Cash Flow trend (last 8 quarters) ===
197
  if "free cash flow" in question.lower() or "fcf" in question.lower():