Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,7 @@ def clean_df(df):
|
|
12 |
print(f"Original columns: {df.columns}")
|
13 |
|
14 |
# Ensure clean URLs from the second column
|
15 |
-
second_col = df.iloc[:,
|
16 |
|
17 |
if second_col.str.contains('http').any() or second_col.str.contains('www').any():
|
18 |
df["url"] = second_col # Already has full URLs
|
@@ -21,18 +21,18 @@ def clean_df(df):
|
|
21 |
df["url"] = "https://www.shl.com" + second_col.str.replace(r'^(?!/)', '/', regex=True)
|
22 |
|
23 |
# Map T/F to Yes/No for remote testing and adaptive support
|
24 |
-
df["remote_support"] = df.iloc[:,
|
25 |
-
df["adaptive_support"] = df.iloc[:,
|
26 |
|
27 |
# Handle test_type properly - convert string representation of list to actual list
|
28 |
-
df["test_type"] = df.iloc[:,
|
29 |
|
30 |
# Get description from column 7
|
31 |
-
df["description"] = df.iloc[:,
|
32 |
|
33 |
# Extract duration with error handling from column 10
|
34 |
df["duration"] = pd.to_numeric(
|
35 |
-
df.iloc[:,
|
36 |
errors='coerce'
|
37 |
)
|
38 |
|
|
|
12 |
print(f"Original columns: {df.columns}")
|
13 |
|
14 |
# Ensure clean URLs from the second column
|
15 |
+
second_col = df.iloc[:, 2].astype(str) # Pre-packaged Job Solutions column
|
16 |
|
17 |
if second_col.str.contains('http').any() or second_col.str.contains('www').any():
|
18 |
df["url"] = second_col # Already has full URLs
|
|
|
21 |
df["url"] = "https://www.shl.com" + second_col.str.replace(r'^(?!/)', '/', regex=True)
|
22 |
|
23 |
# Map T/F to Yes/No for remote testing and adaptive support
|
24 |
+
df["remote_support"] = df.iloc[:, 3].map(lambda x: "Yes" if x == "T" else "No")
|
25 |
+
df["adaptive_support"] = df.iloc[:, 4].map(lambda x: "Yes" if x == "T" else "No")
|
26 |
|
27 |
# Handle test_type properly - convert string representation of list to actual list
|
28 |
+
df["test_type"] = df.iloc[:, 5].apply(lambda x: eval(x) if isinstance(x, str) else x)
|
29 |
|
30 |
# Get description from column 7
|
31 |
+
df["description"] = df.iloc[:, 6]
|
32 |
|
33 |
# Extract duration with error handling from column 10
|
34 |
df["duration"] = pd.to_numeric(
|
35 |
+
df.iloc[:, 9].astype(str).str.extract(r'(\d+)')[0],
|
36 |
errors='coerce'
|
37 |
)
|
38 |
|