James McCool commited on
Commit
2bb9309
·
1 Parent(s): aab2826

addressing an indexing error in the conditionals manager (combos)

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -2584,8 +2584,11 @@ if selected_tab == 'Manage Portfolio':
2584
  target_rows = parsed_frame[containing_mask]
2585
 
2586
  if not target_rows.empty:
 
 
 
2587
  # Prepare DataFrame for exposure_spread to avoid categorical issues
2588
- target_rows_prepared = prepare_dataframe_for_exposure_spread(target_rows, st.session_state['player_columns'])
2589
 
2590
  # Use exposure_spread logic to replace the player in these specific rows
2591
  # Set exposure_target to 0 to remove all instances of replace_player
@@ -2609,7 +2612,7 @@ if selected_tab == 'Manage Portfolio':
2609
  )
2610
 
2611
  # Update the original dataframe with the modified rows
2612
- parsed_frame.loc[containing_mask] = modified_rows
2613
 
2614
  # Use consolidated calculation function
2615
  parsed_frame = calculate_lineup_metrics(
@@ -2647,8 +2650,11 @@ if selected_tab == 'Manage Portfolio':
2647
  target_rows = parsed_frame[containing_mask]
2648
 
2649
  if not target_rows.empty:
 
 
 
2650
  # Prepare DataFrame for exposure_spread to avoid categorical issues
2651
- target_rows_prepared = prepare_dataframe_for_exposure_spread(target_rows, st.session_state['player_columns'])
2652
 
2653
  # Use exposure_spread logic to replace the player in these specific rows
2654
  # Set exposure_target to 0 to remove all instances of replace_player
@@ -2672,7 +2678,7 @@ if selected_tab == 'Manage Portfolio':
2672
  )
2673
 
2674
  # Update the original dataframe with the modified rows
2675
- parsed_frame.loc[containing_mask] = modified_rows
2676
 
2677
  # Use consolidated calculation function for export
2678
  parsed_frame = calculate_lineup_metrics(
 
2584
  target_rows = parsed_frame[containing_mask]
2585
 
2586
  if not target_rows.empty:
2587
+ # Reset index to avoid index mismatch issues
2588
+ target_rows_reset = target_rows.reset_index(drop=True)
2589
+
2590
  # Prepare DataFrame for exposure_spread to avoid categorical issues
2591
+ target_rows_prepared = prepare_dataframe_for_exposure_spread(target_rows_reset, st.session_state['player_columns'])
2592
 
2593
  # Use exposure_spread logic to replace the player in these specific rows
2594
  # Set exposure_target to 0 to remove all instances of replace_player
 
2612
  )
2613
 
2614
  # Update the original dataframe with the modified rows
2615
+ parsed_frame.loc[containing_mask] = modified_rows.values
2616
 
2617
  # Use consolidated calculation function
2618
  parsed_frame = calculate_lineup_metrics(
 
2650
  target_rows = parsed_frame[containing_mask]
2651
 
2652
  if not target_rows.empty:
2653
+ # Reset index to avoid index mismatch issues
2654
+ target_rows_reset = target_rows.reset_index(drop=True)
2655
+
2656
  # Prepare DataFrame for exposure_spread to avoid categorical issues
2657
+ target_rows_prepared = prepare_dataframe_for_exposure_spread(target_rows_reset, st.session_state['player_columns'])
2658
 
2659
  # Use exposure_spread logic to replace the player in these specific rows
2660
  # Set exposure_target to 0 to remove all instances of replace_player
 
2678
  )
2679
 
2680
  # Update the original dataframe with the modified rows
2681
+ parsed_frame.loc[containing_mask] = modified_rows.values
2682
 
2683
  # Use consolidated calculation function for export
2684
  parsed_frame = calculate_lineup_metrics(