IAMTFRMZA commited on
Commit
96ef08b
·
verified ·
1 Parent(s): 0c8b92e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -165,7 +165,7 @@ def quote_year_choices():
165
 
166
  def quote_month_choices(year=None):
167
  """
168
- Returns a sorted list of valid month strings for a given year, or [''] if none.
169
  """
170
  df = get_quotes_df()
171
  if (
@@ -177,8 +177,9 @@ def quote_month_choices(year=None):
177
  subset = df[df["Year"].astype(str) == str(year)]
178
  try:
179
  months = pd.to_numeric(subset["Month"], errors="coerce").dropna().astype(int)
180
- months = sorted({str(m) for m in months if 1 <= m <= 12})
181
- return months if months else [""]
 
182
  except Exception:
183
  return [""]
184
  return [""]
 
165
 
166
  def quote_month_choices(year=None):
167
  """
168
+ Returns a sorted list of valid month strings for a given year, always at least [''].
169
  """
170
  df = get_quotes_df()
171
  if (
 
177
  subset = df[df["Year"].astype(str) == str(year)]
178
  try:
179
  months = pd.to_numeric(subset["Month"], errors="coerce").dropna().astype(int)
180
+ months = [str(m) for m in months if 1 <= m <= 12]
181
+ months = sorted(set(months))
182
+ return [""] + months if months else [""]
183
  except Exception:
184
  return [""]
185
  return [""]