Update loading_file.py
Browse files- loading_file.py +12 -6
loading_file.py
CHANGED
@@ -48,12 +48,18 @@ def fetch_data():
|
|
48 |
df.dropna(how="all", inplace=True)
|
49 |
df.reset_index(drop=True, inplace=True)
|
50 |
|
51 |
-
#
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
df["Application Number"] = df["Application Number"].astype(str)
|
59 |
return df
|
|
|
48 |
df.dropna(how="all", inplace=True)
|
49 |
df.reset_index(drop=True, inplace=True)
|
50 |
|
51 |
+
# Check columns and rename appropriately
|
52 |
+
print("Columns before renaming:", df.columns.tolist()) # For debugging purposes
|
53 |
+
|
54 |
+
# Attempt to rename columns only if there are sufficient columns
|
55 |
+
if len(df.columns) >= 2:
|
56 |
+
df.columns = ["Application Number", "Decision"]
|
57 |
+
else:
|
58 |
+
st.error("Insufficient data columns detected.")
|
59 |
+
return None
|
60 |
+
|
61 |
+
# Only keep relevant columns
|
62 |
+
df = df[["Application Number", "Decision"]]
|
63 |
|
64 |
df["Application Number"] = df["Application Number"].astype(str)
|
65 |
return df
|