File size: 1,943 Bytes
f51c772
b01e348
f51c772
7b2935a
d015d8c
b8a8ac9
 
d015d8c
 
b01e348
 
 
 
 
 
 
 
7b2935a
d015d8c
 
b01e348
d015d8c
b8a8ac9
 
b01e348
b8a8ac9
0543ffc
b01e348
 
7b2935a
b01e348
b8a8ac9
 
b01e348
b8a8ac9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
from global_func.predict_dupes import predict_dupes

def reassess_edge(modified_frame: pd.DataFrame, base_frame: pd.DataFrame, maps_dict: dict, site_var: str, type_var: str, Contest_Size: int, strength_var: str, sport_var: str, max_salary: int) -> pd.DataFrame:
    """
    Reassess edge by concatenating modified frame with base frame, running predict_dupes,
    and then extracting the first N rows (where N is the length of modified_frame).
    
    Args:
        modified_frame: DataFrame with rows that were modified by exposure_spread
        base_frame: Original base frame (base_frame for Portfolio, original export_base for Export)
        maps_dict: Dictionary containing player mappings
        site_var: Site variable (Draftkings/Fanduel)
        type_var: Type variable (Classic/Showdown)
        Contest_Size: Contest size for calculations
        strength_var: Strength variable (Weak/Average/Sharp)
        sport_var: Sport variable
        max_salary: Maximum salary for the contest
        
    Returns:
        DataFrame: Updated modified_frame with recalculated metrics
    """
    # Store the number of rows in the modified frame
    num_modified_rows = len(modified_frame)
    
    # Concatenate the modified frame with the base frame
    combined_frame = pd.concat([modified_frame.drop(columns=['Dupes', 'Finish_percentile', 'Lineup Edge', 'Win%', 'Weighted Own', 'Geomean', 'Diversity']), base_frame.drop(columns=['Dupes', 'Finish_percentile', 'Lineup Edge', 'Win%', 'Weighted Own', 'Geomean', 'Diversity'])], ignore_index=True)
    
    # Run predict_dupes on the combined frame
    updated_combined_frame = predict_dupes(combined_frame, maps_dict, site_var, type_var, Contest_Size, strength_var, sport_var, max_salary)
    
    # Extract the first N rows (which correspond to our modified frame)
    result_frame = updated_combined_frame.head(num_modified_rows).copy()
    
    return result_frame