Update src/streamlit_app.py
Browse files- src/streamlit_app.py +23 -26
src/streamlit_app.py
CHANGED
@@ -25,33 +25,30 @@ st.set_page_config(
|
|
25 |
@st.cache_data
|
26 |
def load_data():
|
27 |
try:
|
28 |
-
#
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
df_combined = pd.concat([df_bits, df_icfai], ignore_index=True)
|
51 |
-
return df_combined, None
|
52 |
-
|
53 |
except Exception as e:
|
54 |
-
return None, f"
|
55 |
|
56 |
|
57 |
# Enhanced RAM extraction with better parsing
|
|
|
25 |
@st.cache_data
|
26 |
def load_data():
|
27 |
try:
|
28 |
+
# Try multiple possible file locations
|
29 |
+
possible_paths = [
|
30 |
+
"Merged_Student_Data.csv", # Current directory
|
31 |
+
"src/Merged_Student_Data.csv", # src subdirectory
|
32 |
+
"./Merged_Student_Data.csv", # Explicit current directory
|
33 |
+
]
|
34 |
+
|
35 |
+
df = None
|
36 |
+
for path in possible_paths:
|
37 |
+
try:
|
38 |
+
df = pd.read_excel(path, sheet_name="Form Responses 1")
|
39 |
+
st.info(f"✅ Successfully loaded data from: {path}")
|
40 |
+
break
|
41 |
+
except FileNotFoundError:
|
42 |
+
continue
|
43 |
+
|
44 |
+
if df is None:
|
45 |
+
return None, "Excel file 'Merged_Student_Data.csv' not found in any expected location. Please ensure the file is in the same directory as this script."
|
46 |
+
|
47 |
+
df.columns = df.columns.str.strip()
|
48 |
+
return df, None
|
49 |
+
|
|
|
|
|
|
|
50 |
except Exception as e:
|
51 |
+
return None, f"Error loading data: {str(e)}"
|
52 |
|
53 |
|
54 |
# Enhanced RAM extraction with better parsing
|