James McCool
commited on
Commit
·
ae976c8
1
Parent(s):
64aecc7
ping ping call me on my phone
Browse files
app.py
CHANGED
|
@@ -1656,7 +1656,6 @@ if selected_tab == 'Data Load':
|
|
| 1656 |
|
| 1657 |
st.subheader("Name Matching Analysis")
|
| 1658 |
|
| 1659 |
-
# Get unique names from portfolio
|
| 1660 |
portfolio_names = get_portfolio_names(st.session_state['portfolio'])
|
| 1661 |
try:
|
| 1662 |
csv_names = st.session_state['csv_file']['Name'].tolist()
|
|
@@ -1666,18 +1665,14 @@ if selected_tab == 'Data Load':
|
|
| 1666 |
|
| 1667 |
portfolio_match_dict, unmatched_names = chunk_name_matching(portfolio_names, csv_names)
|
| 1668 |
|
| 1669 |
-
# Update portfolio with matched names (in-place to save memory)
|
| 1670 |
player_columns = [col for col in st.session_state['portfolio'].columns
|
| 1671 |
if col not in ['salary', 'median', 'Own']]
|
| 1672 |
|
| 1673 |
-
# For each player column, update names using the match dictionary
|
| 1674 |
for col in player_columns:
|
| 1675 |
st.session_state['portfolio'][col] = st.session_state['portfolio'][col].map(lambda x: portfolio_match_dict.get(x, x))
|
| 1676 |
|
| 1677 |
-
# Create match dictionary for projections to CSV names (chunked)
|
| 1678 |
projections_match_dict, unmatched_proj_names = chunk_name_matching(projection_names, csv_names)
|
| 1679 |
|
| 1680 |
-
# Update projections with matched names
|
| 1681 |
projections['player_names'] = projections['player_names'].map(lambda x: projections_match_dict.get(x, x))
|
| 1682 |
st.session_state['projections_df'] = projections
|
| 1683 |
|
|
|
|
| 1656 |
|
| 1657 |
st.subheader("Name Matching Analysis")
|
| 1658 |
|
|
|
|
| 1659 |
portfolio_names = get_portfolio_names(st.session_state['portfolio'])
|
| 1660 |
try:
|
| 1661 |
csv_names = st.session_state['csv_file']['Name'].tolist()
|
|
|
|
| 1665 |
|
| 1666 |
portfolio_match_dict, unmatched_names = chunk_name_matching(portfolio_names, csv_names)
|
| 1667 |
|
|
|
|
| 1668 |
player_columns = [col for col in st.session_state['portfolio'].columns
|
| 1669 |
if col not in ['salary', 'median', 'Own']]
|
| 1670 |
|
|
|
|
| 1671 |
for col in player_columns:
|
| 1672 |
st.session_state['portfolio'][col] = st.session_state['portfolio'][col].map(lambda x: portfolio_match_dict.get(x, x))
|
| 1673 |
|
|
|
|
| 1674 |
projections_match_dict, unmatched_proj_names = chunk_name_matching(projection_names, csv_names)
|
| 1675 |
|
|
|
|
| 1676 |
projections['player_names'] = projections['player_names'].map(lambda x: projections_match_dict.get(x, x))
|
| 1677 |
st.session_state['projections_df'] = projections
|
| 1678 |
|