James McCool
commited on
Commit
·
449ebce
1
Parent(s):
4162581
Refine position filtering logic in create_position_export_dict function in app.py to remove trailing digits from column names, and update debug print statements to log structured output of filtered DataFrames for better data validation.
Browse files
app.py
CHANGED
@@ -40,7 +40,7 @@ def create_position_export_dict(column_name, csv_file):
|
|
40 |
try:
|
41 |
# Remove any numbers from the column name to get the position
|
42 |
import re
|
43 |
-
position_filter = re.sub(r'\d
|
44 |
|
45 |
print(position_filter)
|
46 |
|
@@ -57,12 +57,12 @@ def create_position_export_dict(column_name, csv_file):
|
|
57 |
|
58 |
try:
|
59 |
filtered_df = filtered_df.sort_values(by='Salary', ascending=False).drop_duplicates(subset=['Name'])
|
60 |
-
print(filtered_df)
|
61 |
return dict(zip(filtered_df['Name'], filtered_df['Name + ID']))
|
62 |
except:
|
63 |
try:
|
64 |
filtered_df = filtered_df.sort_values(by='Salary', ascending=False).drop_duplicates(subset=['Nickname'])
|
65 |
-
print(filtered_df)
|
66 |
return dict(zip(filtered_df['Nickname'], filtered_df['Id']))
|
67 |
except:
|
68 |
# Final fallback
|
|
|
40 |
try:
|
41 |
# Remove any numbers from the column name to get the position
|
42 |
import re
|
43 |
+
position_filter = re.sub(r'\d+$', '', column_name)
|
44 |
|
45 |
print(position_filter)
|
46 |
|
|
|
57 |
|
58 |
try:
|
59 |
filtered_df = filtered_df.sort_values(by='Salary', ascending=False).drop_duplicates(subset=['Name'])
|
60 |
+
print(dict(zip(filtered_df['Name'], filtered_df['Name + ID'])))
|
61 |
return dict(zip(filtered_df['Name'], filtered_df['Name + ID']))
|
62 |
except:
|
63 |
try:
|
64 |
filtered_df = filtered_df.sort_values(by='Salary', ascending=False).drop_duplicates(subset=['Nickname'])
|
65 |
+
print(dict(zip(filtered_df['Nickname'], filtered_df['Id'])))
|
66 |
return dict(zip(filtered_df['Nickname'], filtered_df['Id']))
|
67 |
except:
|
68 |
# Final fallback
|