From f562ac82e7bf270831b946dbd12ce84035e2737b Mon Sep 17 00:00:00 2001 From: "zakariya.saoula" Date: Fri, 9 Feb 2024 13:02:13 +0100 Subject: [PATCH] :bug: fix and add comment --- test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test.py b/test.py index 8602b5d..151422e 100644 --- a/test.py +++ b/test.py @@ -127,11 +127,17 @@ print(select_fight_row(df, 'Khabib Nurmagomedov', 0)) # get all active UFC fighters (according to the limit_date parameter) def list_fighters(df, limit_date): + # Filter the DataFrame to include only fights occurring after the specified limit date df_temp = df[df['date'] > limit_date] + # Create a set of all fighters from the red corner ('R_fighter') in the filtered DataFrame set_R = set(df_temp['R_fighter']) + # Create a set of all fighters from the blue corner ('B_fighter') in the filtered DataFrame set_B = set(df_temp['B_fighter']) + # Combine the sets of fighters from the red and blue corners to get all unique fighters fighters = list(set_R.union(set_B)) - print("Number of fighter: "+str(len(fighters))) + # Print the number of unique fighters included in the list + # print("Number of fighters: " + str(len(fighters))) + # Return the list of unique fighters return fighters # Last year when data fight was not full and correct