James McCool
commited on
Commit
·
a31c2f9
1
Parent(s):
9d66c9c
Enhance salary data processing in load_file.py: add a try-except block to convert salary values to integers after removing unwanted characters, improving data integrity during file handling.
Browse files- global_func/load_file.py +6 -0
global_func/load_file.py
CHANGED
@@ -24,6 +24,12 @@ def load_file(upload):
|
|
24 |
st.error('Please upload either a CSV or Excel file')
|
25 |
return None, None
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
export_df = df.copy()
|
28 |
|
29 |
for col in df.columns:
|
|
|
24 |
st.error('Please upload either a CSV or Excel file')
|
25 |
return None, None
|
26 |
|
27 |
+
try:
|
28 |
+
df['salary'] = df['salary'].astype(str).str.replace([',', '$', ' '], '', regex=True).astype(int)
|
29 |
+
st.print('replaced salary symbols')
|
30 |
+
except:
|
31 |
+
pass
|
32 |
+
|
33 |
export_df = df.copy()
|
34 |
|
35 |
for col in df.columns:
|