James McCool commited on
Commit
70f0305
·
1 Parent(s): 3b2f6ef

Update position lists in load_contest_file function for MMA and GOLF

Browse files

- Added 'Buddy' to the position lists for both MMA and GOLF, enhancing the flexibility of player role assignments.
- Updated DataFrame structures to accommodate the new position, ensuring consistent data processing across sports.
- Maintained existing functionality while improving the application's capability to handle diverse player roles.

Files changed (1) hide show
  1. global_func/load_contest_file.py +6 -6
global_func/load_contest_file.py CHANGED
@@ -5,9 +5,9 @@ def load_contest_file(upload, helper = None, sport = None):
5
  if sport == 'MLB':
6
  pos_list = [' P ', ' C ', '1B ', ' 2B ', ' 3B ', ' SS ', ' OF ']
7
  elif sport == 'MMA':
8
- pos_list = ['Guy', 'Dude', 'Pooba', 'Bub', 'Chief']
9
  elif sport == 'GOLF':
10
- pos_list = ['Guy', 'Dude', 'Pooba', 'Bub', 'Chief']
11
  if upload is not None:
12
  try:
13
  try:
@@ -76,18 +76,18 @@ def load_contest_file(upload, helper = None, sport = None):
76
  if sport == 'MLB':
77
  cleaned_df[['Remove', '1B', '2B', '3B', 'C', 'OF1', 'OF2', 'OF3', 'P1', 'P2', 'SS']] = cleaned_df['Lineup'].str.split(',', expand=True)
78
  elif sport == 'MMA':
79
- cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief']] = cleaned_df['Lineup'].str.split(',', expand=True)
80
  elif sport == 'GOLF':
81
- cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief']] = cleaned_df['Lineup'].str.split(',', expand=True)
82
  cleaned_df = cleaned_df.drop(columns=['Lineup', 'Remove'])
83
  entry_counts = cleaned_df['BaseName'].value_counts()
84
  cleaned_df['EntryCount'] = cleaned_df['BaseName'].map(entry_counts)
85
  if sport == 'MLB':
86
  cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'P1', 'P2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3']]
87
  elif sport == 'MMA':
88
- cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief']]
89
  elif sport == 'GOLF':
90
- cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief']]
91
 
92
  print('Made it through check_lineups')
93
 
 
5
  if sport == 'MLB':
6
  pos_list = [' P ', ' C ', '1B ', ' 2B ', ' 3B ', ' SS ', ' OF ']
7
  elif sport == 'MMA':
8
+ pos_list = ['Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']
9
  elif sport == 'GOLF':
10
+ pos_list = ['Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']
11
  if upload is not None:
12
  try:
13
  try:
 
76
  if sport == 'MLB':
77
  cleaned_df[['Remove', '1B', '2B', '3B', 'C', 'OF1', 'OF2', 'OF3', 'P1', 'P2', 'SS']] = cleaned_df['Lineup'].str.split(',', expand=True)
78
  elif sport == 'MMA':
79
+ cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
80
  elif sport == 'GOLF':
81
+ cleaned_df[['Remove', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']] = cleaned_df['Lineup'].str.split(',', expand=True)
82
  cleaned_df = cleaned_df.drop(columns=['Lineup', 'Remove'])
83
  entry_counts = cleaned_df['BaseName'].value_counts()
84
  cleaned_df['EntryCount'] = cleaned_df['BaseName'].map(entry_counts)
85
  if sport == 'MLB':
86
  cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'P1', 'P2', 'C', '1B', '2B', '3B', 'SS', 'OF1', 'OF2', 'OF3']]
87
  elif sport == 'MMA':
88
+ cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']]
89
  elif sport == 'GOLF':
90
+ cleaned_df = cleaned_df[['BaseName', 'EntryCount', 'Guy', 'Dude', 'Pooba', 'Bub', 'Chief', 'Buddy']]
91
 
92
  print('Made it through check_lineups')
93