willyg23 / UFC-Machine-Learning-and-Data-Visualization

0 stars 0 forks source link

Merge final_df and ufc_old_data #6

Open willyg23 opened 5 months ago

willyg23 commented 5 months ago

so our goal is to take the columns from ufc_old_data that are relevant to individual fights and are columns that final_df doesn't currently have. Then apply these columns to the individual fights they correspond to. columns from ufc_old_data i'd like to add:

B_longest_win_streak, B_losses, B_total_rounds_fought, B_total_title_bouts, B_win_by_Decision_Majority, B_win_by_Decision_Split, B_win_by_Decision_Unanimous, B_win_by_KO/TKO, B_win_by_Submission, B_win_by_TKO_Doctor_Stoppage, B_wins, B_current_lose_streak, B_current_win_streak, B_draw R_longest_win_streak, R_losses, R_total_rounds_fought, R_total_title_bouts, R_win_by_Decision_Majority, R_win_by_Decision_Split, R_win_by_Decision_Unanimous, R_win_by_KO/TKO, R_win_by_Submission, R_win_by_TKO_Doctor_Stoppage, R_wins, R_current_lose_streak, R_current_win_streak, R_draw R_odds, B_odds, r_dec_odds, b_dec_odds, r_sub_odds, b_sub_odds, r_ko_odds, b_ko_odds

let's call that collection of columns "data_transfer_column_names"

so, how do we merge these columns into final_df ? let's use a fighter's name and the day they fought on. There won't be any duplicates of this, and it will correspond with a singular fight.

get a fighter's name and date they fought on from ufc_old_data, and call it old_data_fighter_name. In ufc_old_data, there are two columns we can get fighter's names from; R_fighter and B_fighter. get the name from R_fighter. Since we'll be adding stats for both fighters, we only need one of their names per fight. get a fighter's name and date they fought on from final_df, and call it new_data_fighter_name. In final_df, there are two columns we can get fighter's names from; R_fighter and B_fighter.

now, let's merge the all columns defined in data_transfer_column_names of ufc_old_data, into final_df, on where old_data_fighter_name and new_data_fighter_name match.