James McCool
commited on
Commit
·
ede753b
1
Parent(s):
23ee048
Refactor find_name_mismatches function in find_name_mismatches.py
Browse files- Removed the 'calc_toggle' parameter from the find_name_mismatches function, simplifying its signature and logic.
- Streamlined the return values to focus solely on the dataframes, enhancing clarity and reducing unnecessary complexity in the function's operation.
global_func/find_name_mismatches.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from fuzzywuzzy import process
|
| 3 |
|
| 4 |
-
def find_name_mismatches(contest_df, projections_df, ownership_df, fpts_df
|
| 5 |
|
| 6 |
name_columns = [col for col in contest_df.columns if not col in ['BaseName', 'EntryCount']]
|
| 7 |
|
|
@@ -86,13 +86,11 @@ def find_name_mismatches(contest_df, projections_df, ownership_df, fpts_df, calc
|
|
| 86 |
fpts_df['Player'] = fpts_df['Player'].replace(selected_name, projection_name)
|
| 87 |
st.write(contest_name + ' ' + projection_name)
|
| 88 |
st.success(f"Replaced '{selected_name}' with '{projection_name}'")
|
| 89 |
-
calc_toggle = True
|
| 90 |
st.success("All changes applied successfully!")
|
| 91 |
-
return contest_df, projections_df, ownership_df, fpts_df
|
| 92 |
else:
|
| 93 |
-
calc_toggle = False
|
| 94 |
st.success("No changes applied")
|
| 95 |
-
return contest_df, projections_df, ownership_df, fpts_df
|
| 96 |
else:
|
| 97 |
st.success("All players have been automatically matched!")
|
| 98 |
# Apply automatic matches
|
|
@@ -102,5 +100,4 @@ def find_name_mismatches(contest_df, projections_df, ownership_df, fpts_df, calc
|
|
| 102 |
ownership_df['Player'] = ownership_df['Player'].replace(contest_name, projection_name)
|
| 103 |
fpts_df['Player'] = fpts_df['Player'].replace(contest_name, projection_name)
|
| 104 |
st.write(contest_name + ' ' + projection_name)
|
| 105 |
-
|
| 106 |
-
return contest_df, projections_df, ownership_df, fpts_df, calc_toggle
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from fuzzywuzzy import process
|
| 3 |
|
| 4 |
+
def find_name_mismatches(contest_df, projections_df, ownership_df, fpts_df):
|
| 5 |
|
| 6 |
name_columns = [col for col in contest_df.columns if not col in ['BaseName', 'EntryCount']]
|
| 7 |
|
|
|
|
| 86 |
fpts_df['Player'] = fpts_df['Player'].replace(selected_name, projection_name)
|
| 87 |
st.write(contest_name + ' ' + projection_name)
|
| 88 |
st.success(f"Replaced '{selected_name}' with '{projection_name}'")
|
|
|
|
| 89 |
st.success("All changes applied successfully!")
|
| 90 |
+
return contest_df, projections_df, ownership_df, fpts_df
|
| 91 |
else:
|
|
|
|
| 92 |
st.success("No changes applied")
|
| 93 |
+
return contest_df, projections_df, ownership_df, fpts_df
|
| 94 |
else:
|
| 95 |
st.success("All players have been automatically matched!")
|
| 96 |
# Apply automatic matches
|
|
|
|
| 100 |
ownership_df['Player'] = ownership_df['Player'].replace(contest_name, projection_name)
|
| 101 |
fpts_df['Player'] = fpts_df['Player'].replace(contest_name, projection_name)
|
| 102 |
st.write(contest_name + ' ' + projection_name)
|
| 103 |
+
return contest_df, projections_df, ownership_df, fpts_df
|
|
|