rairo commited on
Commit
680d9f2
·
verified ·
1 Parent(s): a35b8e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -46,9 +46,9 @@ def safe_display_df(df: pd.DataFrame) -> pd.DataFrame:
46
  def main():
47
  st.title("Merge Employee Name from Earnings into PAYE Sheet")
48
  st.write(
49
- "Upload an Earnings Sheet and a PAYE Sheet. "
50
- "The app will extract the first two columns (TIN and Employee Name) from the Earnings Sheet, "
51
- "clean and standardize the TIN values, and then merge the Employee Name onto the PAYE sheet using the TIN."
52
  )
53
 
54
  earnings_file = st.file_uploader("Upload Earnings Sheet", type=["csv", "xlsx", "xls"], key="earnings")
@@ -73,17 +73,17 @@ def main():
73
  return
74
 
75
  # Extract first two columns from earnings file.
76
- # Assume first column is TIN and second is Employee Name.
77
- earnings_subset = earnings_df.iloc[:, :2].copy()
78
  earnings_subset.columns = ["tin", "employee_name"]
79
  # Ensure values are stripped of trailing spaces
80
  earnings_subset["tin"] = earnings_subset["tin"].astype(str).str.strip()
81
  earnings_subset["employee_name"] = earnings_subset["employee_name"].astype(str).str.strip()
82
 
83
- st.write("Preview of extracted TIN and Employee Name from Earnings Sheet:")
84
  st.dataframe(safe_display_df(earnings_subset.head()))
85
 
86
- # Verify the PAYE sheet has a 'tin' column
87
  if "tin" not in paye_df.columns:
88
  st.error("The PAYE sheet does not have a recognized TIN column (e.g., 'tin' or 'personal id').")
89
  return
 
46
  def main():
47
  st.title("Merge Employee Name from Earnings into PAYE Sheet")
48
  st.write(
49
+ "Upload an Earnings Sheet and a PAYE Sheet. The app will extract the first two columns "
50
+ "(TIN and Employee Name) from the Earnings Sheet, skipping the first row which contains currency labels, "
51
+ "and merge the Employee Name onto the PAYE sheet using the cleaned TIN."
52
  )
53
 
54
  earnings_file = st.file_uploader("Upload Earnings Sheet", type=["csv", "xlsx", "xls"], key="earnings")
 
73
  return
74
 
75
  # Extract first two columns from earnings file.
76
+ # Skip the first row (assumed to contain currency labels) using .iloc[1:]
77
+ earnings_subset = earnings_df.iloc[1:, :2].copy()
78
  earnings_subset.columns = ["tin", "employee_name"]
79
  # Ensure values are stripped of trailing spaces
80
  earnings_subset["tin"] = earnings_subset["tin"].astype(str).str.strip()
81
  earnings_subset["employee_name"] = earnings_subset["employee_name"].astype(str).str.strip()
82
 
83
+ st.write("Preview of extracted TIN and Employee Name from Earnings Sheet (first 5 rows after skipping currency row):")
84
  st.dataframe(safe_display_df(earnings_subset.head()))
85
 
86
+ # Verify the PAYE sheet has a 'tin' column.
87
  if "tin" not in paye_df.columns:
88
  st.error("The PAYE sheet does not have a recognized TIN column (e.g., 'tin' or 'personal id').")
89
  return