Alaiy commited on
Commit
fe529a6
·
verified ·
1 Parent(s): 1bed12c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -2
app.py CHANGED
@@ -1157,7 +1157,7 @@ def fetch_and_store_data_market():
1157
  to_date = (datetime.now() - timedelta(days=1)).strftime('%d %b %Y')
1158
  from_date_obj = datetime.strptime(from_date, '%d %b %Y')
1159
  to_date_obj = datetime.strptime(to_date, '%d %b %Y')
1160
- if to_date < from_date:
1161
  print("Data already scraped")
1162
  return None
1163
  # Build the URL to be requested
@@ -1206,7 +1206,6 @@ def fetch_and_store_data_market():
1206
  df.dropna(subset=["Price Date"], inplace=True)
1207
  df.sort_values(by="Price Date", inplace=True)
1208
  df = df[df["Grade"]=="FAQ"]
1209
- # Type casting for the columns
1210
  df["Modal Price (Rs./Quintal)"] = pd.to_numeric(df["Modal Price (Rs./Quintal)"], errors='coerce').astype("int64")
1211
  df["Market Name"] = df["Market Name"].astype("string")
1212
  df.rename(columns={"Price Date": "Reported Date"}, inplace=True)
 
1157
  to_date = (datetime.now() - timedelta(days=1)).strftime('%d %b %Y')
1158
  from_date_obj = datetime.strptime(from_date, '%d %b %Y')
1159
  to_date_obj = datetime.strptime(to_date, '%d %b %Y')
1160
+ if from_date_obj < to_date_obj:
1161
  print("Data already scraped")
1162
  return None
1163
  # Build the URL to be requested
 
1206
  df.dropna(subset=["Price Date"], inplace=True)
1207
  df.sort_values(by="Price Date", inplace=True)
1208
  df = df[df["Grade"]=="FAQ"]
 
1209
  df["Modal Price (Rs./Quintal)"] = pd.to_numeric(df["Modal Price (Rs./Quintal)"], errors='coerce').astype("int64")
1210
  df["Market Name"] = df["Market Name"].astype("string")
1211
  df.rename(columns={"Price Date": "Reported Date"}, inplace=True)