James McCool commited on
Commit
faff605
·
1 Parent(s): 44b9f1d

Refactor clean_player_name function in load_file.py

Browse files

- Moved the clean_player_name function definition into load_file.py, enhancing code organization.
- Improved the function to handle specific cases for colons and parentheses, ensuring cleaner player name processing.
- This change streamlines the name cleaning process, improving overall data handling in the application.

Files changed (1) hide show
  1. global_func/load_file.py +10 -2
global_func/load_file.py CHANGED
@@ -4,8 +4,16 @@ import pandas as pd
4
  import time
5
  from fuzzywuzzy import process
6
 
7
- ## import global functions
8
- from global_func.clean_player_name import clean_player_name
 
 
 
 
 
 
 
 
9
 
10
  def load_file(upload):
11
  if upload is not None:
 
4
  import time
5
  from fuzzywuzzy import process
6
 
7
+ def clean_player_name(name):
8
+ # Handle colon case first (remove everything before colon)
9
+ if ':' in name:
10
+ name = name.split(':')[1].strip()
11
+
12
+ # Handle parentheses case (remove everything after opening parenthesis)
13
+ if '(' in name:
14
+ name = name.split('(')[0].strip()
15
+
16
+ return name
17
 
18
  def load_file(upload):
19
  if upload is not None: