AnshulS commited on
Commit
ff8f4fb
·
verified ·
1 Parent(s): d93bcf7

Update app.py

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