James McCool commited on
Commit
8f74703
·
1 Parent(s): 3c0866b

Enhance salary data processing by converting salary values to integers in CSV and Excel uploads

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -32,8 +32,10 @@ def load_file(upload):
32
  try:
33
  if upload.name.endswith('.csv'):
34
  df = pd.read_csv(upload)
 
35
  elif upload.name.endswith(('.xls', '.xlsx')):
36
  df = pd.read_excel(upload)
 
37
  else:
38
  st.error('Please upload either a CSV or Excel file')
39
  return None
 
32
  try:
33
  if upload.name.endswith('.csv'):
34
  df = pd.read_csv(upload)
35
+ df['Salary'] = df['Salary'].astype(str).str.replace(',', '').astype(int)
36
  elif upload.name.endswith(('.xls', '.xlsx')):
37
  df = pd.read_excel(upload)
38
+ df['Salary'] = df['Salary'].astype(str).str.replace(',', '').astype(int)
39
  else:
40
  st.error('Please upload either a CSV or Excel file')
41
  return None