sharanyaswarup commited on
Commit
1314148
·
1 Parent(s): 5066037

Fix pandas sorting bug in alias_sync

Browse files
Files changed (1) hide show
  1. alias_sync.py +3 -0
alias_sync.py CHANGED
@@ -120,6 +120,9 @@ def sync_aliases(token: str, repo: str):
120
 
121
  df = pd.DataFrame(rows, columns=["UDISE_Code", "Alias_Name", "Source", "Year_Month", "Last_Updated"])
122
 
 
 
 
123
  # Sort by UDISE code so that all identical schools are grouped together perfectly
124
  df = df.sort_values(by=["UDISE_Code", "Source"]).reset_index(drop=True)
125
 
 
120
 
121
  df = pd.DataFrame(rows, columns=["UDISE_Code", "Alias_Name", "Source", "Year_Month", "Last_Updated"])
122
 
123
+ # Force string type to prevent sorting errors
124
+ df["UDISE_Code"] = df["UDISE_Code"].astype(str)
125
+
126
  # Sort by UDISE code so that all identical schools are grouped together perfectly
127
  df = df.sort_values(by=["UDISE_Code", "Source"]).reset_index(drop=True)
128