Skip to content

Commit

Permalink
remove base_code due duplicate of set_code
Browse files Browse the repository at this point in the history
  • Loading branch information
napo committed Oct 29, 2024
1 parent f994895 commit b1905e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
24 changes: 1 addition & 23 deletions datavolley/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,28 +234,6 @@ def get_set(rows_list):
df = df_cleaned
return df

def get_base_code(code):
"""
Extracts the base code value from a given row of data.
Parameters:
code (str): A string containing data from which the base attack value is to be extracted.
Returns:
string | None: The base attack value extracted from the code.
The function returns a string if a valid base value is found
or None if no value is applicable.
This function processes a single code to determine the base attack metric,
depending on the structure and content of the string.
"""
bs = None
if code.find("E") > -1:
bs = code[6:8]
if bs == '~~':
bs = None
return bs

# get player number out of code
def calculate_skill(row):
"""
Expand Down Expand Up @@ -305,7 +283,7 @@ def calculate_skill(row):
'player_name', 'player_id', 'skill', 'skill_type',
'evaluation_code', 'setter_position', 'evaluation',
'attack_code', 'attack_description', 'set_code',
'set_description', 'set_type', 'base_code',
'set_description', 'set_type',
'start_zone', 'end_zone',
'end_subzone', 'end_cone', 'skill_subtype',
'num_players', 'num_players_numeric', 'special_code',
Expand Down
4 changes: 1 addition & 3 deletions datavolley/read_dv.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from .helpers import get_match, get_set, get_teams,\
calculate_skill, skill_map, eval_codes,\
desired_order, add_xy, get_setter_calls,\
get_attack_combinations, get_base_code
get_attack_combinations

pd.set_option('future.no_silent_downcasting', True)

Expand Down Expand Up @@ -417,8 +417,6 @@ def replace_coordinates(coord):
plays['skill'] = plays.apply(calculate_skill, axis=1)
plays['skill'] = plays['skill'].map(skill_map)

# Create base_code
plays['base_code'] = plays['code'].apply(get_base_code)
# Create evaluation_code
plays['evaluation_code'] = plays['code'].str[5]
plays['evaluation_code'] =\
Expand Down

0 comments on commit b1905e0

Please sign in to comment.