James McCool commited on
Commit
3894e93
·
1 Parent(s): 6e5cc93

Add handling for 'Showdown' contest type in load_contest_file.py

Browse files

- Introduced logic to adjust fantasy points for players in 'Showdown' contests by applying a multiplier for the 'CPT' position.
- Enhanced data processing for contest-specific calculations while maintaining existing functionality.

Files changed (1) hide show
  1. global_func/load_contest_file.py +3 -0
global_func/load_contest_file.py CHANGED
@@ -1,6 +1,7 @@
1
  import streamlit as st
2
  import pandas as pd
3
  from rapidfuzz import process, fuzz
 
4
 
5
  def load_contest_file(upload, type, helper = None, sport = None):
6
  if upload is not None:
@@ -33,6 +34,8 @@ def load_contest_file(upload, type, helper = None, sport = None):
33
  df['BaseName'] = df['EntryName'].str.replace(r'\s*\(\d+/\d+\)$', '', regex=True)
34
  df['EntryCount'] = df['EntryName'].str.extract(r'\((\d+/\d+)\)')
35
  df['EntryCount'] = df['EntryCount'].fillna('1/1') # Default to 1/1 if no entry count
 
 
36
 
37
  # Convert ownership percentage to float
38
  try:
 
1
  import streamlit as st
2
  import pandas as pd
3
  from rapidfuzz import process, fuzz
4
+ from numpy import where as np_where
5
 
6
  def load_contest_file(upload, type, helper = None, sport = None):
7
  if upload is not None:
 
34
  df['BaseName'] = df['EntryName'].str.replace(r'\s*\(\d+/\d+\)$', '', regex=True)
35
  df['EntryCount'] = df['EntryName'].str.extract(r'\((\d+/\d+)\)')
36
  df['EntryCount'] = df['EntryCount'].fillna('1/1') # Default to 1/1 if no entry count
37
+ if type == 'Showdown':
38
+ df['FPTS'] = np_where(df['Pos'] == 'CPT', df['FPTS'] / 1.5, df['FPTS'])
39
 
40
  # Convert ownership percentage to float
41
  try: