James McCool
commited on
Commit
·
7740ecc
1
Parent(s):
889410b
Add helper name matching in load_contest_file.py for improved contest data processing
Browse files- Introduced a new dictionary to match helper names with contest names, enhancing the accuracy of player data mapping.
- Ensured that unmatched helper names are added to the contest match dictionary, maintaining data integrity.
- Improved overall functionality while refining the contest file loading process.
global_func/load_contest_file.py
CHANGED
@@ -54,6 +54,7 @@ def load_contest_file(upload, helper = None, sport = None):
|
|
54 |
helper_names = helper_df.Player.unique()
|
55 |
|
56 |
contest_match_dict = {}
|
|
|
57 |
for names in contest_names:
|
58 |
match = process.extractOne(
|
59 |
names,
|
@@ -65,6 +66,21 @@ def load_contest_file(upload, helper = None, sport = None):
|
|
65 |
else:
|
66 |
contest_match_dict[names] = names
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
df_helper['Player'] = df_helper['Player'].map(contest_match_dict)
|
69 |
|
70 |
print(df_helper[df_helper['Player'] == 'Luis Torrens'])
|
|
|
54 |
helper_names = helper_df.Player.unique()
|
55 |
|
56 |
contest_match_dict = {}
|
57 |
+
helper_match_dict = {}
|
58 |
for names in contest_names:
|
59 |
match = process.extractOne(
|
60 |
names,
|
|
|
66 |
else:
|
67 |
contest_match_dict[names] = names
|
68 |
|
69 |
+
for names in helper_names:
|
70 |
+
match = process.extractOne(
|
71 |
+
names,
|
72 |
+
contest_names,
|
73 |
+
score_cutoff = 85
|
74 |
+
)
|
75 |
+
if match:
|
76 |
+
helper_match_dict[names] = match[0]
|
77 |
+
else:
|
78 |
+
helper_match_dict[names] = names
|
79 |
+
|
80 |
+
for key, value in helper_match_dict.items():
|
81 |
+
if key not in contest_match_dict:
|
82 |
+
contest_match_dict[key] = value
|
83 |
+
|
84 |
df_helper['Player'] = df_helper['Player'].map(contest_match_dict)
|
85 |
|
86 |
print(df_helper[df_helper['Player'] == 'Luis Torrens'])
|