PrathameshRaut commited on
Commit
daadfa7
·
verified ·
1 Parent(s): 1073f04

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +4 -1
main.py CHANGED
@@ -184,7 +184,10 @@ async def lifespan(app: FastAPI):
184
  hostel_df = masters.get("Hostels", pd.DataFrame())
185
  if not hostel_df.empty:
186
  for _, row in hostel_df.iterrows():
187
- hid = int(str(row["HostelID"]).strip())
 
 
 
188
  hostel_map[hid] = {
189
  "hostel_id": hid,
190
  "name": str(row.get("HostelName", row.get("HostelName_Old", ""))).strip(),
 
184
  hostel_df = masters.get("Hostels", pd.DataFrame())
185
  if not hostel_df.empty:
186
  for _, row in hostel_df.iterrows():
187
+ raw_id = str(row["HostelID"]).strip()
188
+ if not raw_id.isdigit():
189
+ continue # skip bad rows (address in ID column etc.)
190
+ hid = int(raw_id)
191
  hostel_map[hid] = {
192
  "hostel_id": hid,
193
  "name": str(row.get("HostelName", row.get("HostelName_Old", ""))).strip(),