dibend commited on
Commit
5dada9c
1 Parent(s): 4e30a9b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -16,8 +16,13 @@ def plot_and_predict(zip, start_year, start_month, prediction_months):
16
  if not start_year.isdigit() or not (2000 <= int(start_year) <= current_year):
17
  return f"Error: Please enter a valid year between 2000 and {current_year}."
18
 
19
- # Combine year and month into a start date
20
- start_date = f"{start_year}-{start_month:02d}-01"
 
 
 
 
 
21
  start_date = pd.to_datetime(start_date)
22
 
23
  # Read and process the real estate data from Zillow
 
16
  if not start_year.isdigit() or not (2000 <= int(start_year) <= current_year):
17
  return f"Error: Please enter a valid year between 2000 and {current_year}."
18
 
19
+ # Convert start_month to integer and combine year and month into a start date
20
+ try:
21
+ start_month_int = int(start_month)
22
+ start_date = f"{start_year}-{start_month_int:02d}-01"
23
+ except ValueError:
24
+ return "Error: Invalid start month. Please enter a numeric month between 1 and 12."
25
+
26
  start_date = pd.to_datetime(start_date)
27
 
28
  # Read and process the real estate data from Zillow