From 54d6840eb9750c4518a0e7ebed68823cd4ccf97c Mon Sep 17 00:00:00 2001 From: Gyorgy Szaszko Date: Wed, 17 Jul 2024 18:13:00 +0200 Subject: [PATCH] showcases: fix FutureWarning: ChainedAssignmentError in anf files --- .../clockdrift/ClockDriftShowcase.anf | 36 +++++++++---------- .../timesynchronization/gptp/GptpShowcase.anf | 16 ++++----- showcases/wireless/errorrate/ErrorRate.anf | 2 +- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/showcases/tsn/timesynchronization/clockdrift/ClockDriftShowcase.anf b/showcases/tsn/timesynchronization/clockdrift/ClockDriftShowcase.anf index 3689fe9d8e0..8de8901f518 100644 --- a/showcases/tsn/timesynchronization/clockdrift/ClockDriftShowcase.anf +++ b/showcases/tsn/timesynchronization/clockdrift/ClockDriftShowcase.anf @@ -48,8 +48,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -629,8 +629,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -1210,8 +1210,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -1791,8 +1791,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -2372,8 +2372,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -2953,8 +2953,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -3534,8 +3534,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -4117,8 +4117,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) @@ -4698,8 +4698,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df['legend'])): - df['legend'][i] = df['module'][i].replace('ClockDriftShowcase.','') - df['legend'][i] = df['legend'][i].replace('.clock','') + df.loc[i, 'legend'] = df.loc[i, 'module'].replace('ClockDriftShowcase.','') + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace('.clock','') # plot utils.plot_vectors(df, props) diff --git a/showcases/tsn/timesynchronization/gptp/GptpShowcase.anf b/showcases/tsn/timesynchronization/gptp/GptpShowcase.anf index 03d358bc039..61c5a8f256d 100644 --- a/showcases/tsn/timesynchronization/gptp/GptpShowcase.anf +++ b/showcases/tsn/timesynchronization/gptp/GptpShowcase.anf @@ -41,8 +41,8 @@ if df.empty: df['legend'] = df['module'] for i in range(0,len(df)): - df['legend'][i] = df['legend'][i].replace("OneMasterClockGptpShowcase.","") - df['legend'][i] = df['legend'][i].replace(".clock","") + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace("OneMasterClockGptpShowcase.","") + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace(".clock","") # apply vector operations df = utils.perform_vector_ops(df, props["vector_operations"]) @@ -628,8 +628,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df)): - df['legend'][i] = df['legend'][i].replace("TwoMasterClocksTreeGptpShowcase.","") -# df['legend'][i] = df['legend'][i].replace(".clock","") + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace("TwoMasterClocksTreeGptpShowcase.","") +# df.loc[i, 'legend'] = df.loc[i, 'legend'].replace(".clock","") # plot utils.plot_vectors(df, props) @@ -1204,8 +1204,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df)): - df['legend'][i] = df['legend'][i].replace("TwoMasterClocksTreeGptpShowcase.","") -# df['legend'][i] = df['legend'][i].replace(".clock[0]","") + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace("TwoMasterClocksTreeGptpShowcase.","") +# df.loc[i, 'legend'] = df.loc[i, 'legend'].replace(".clock[0]","") # plot utils.plot_vectors(df, props) @@ -1780,8 +1780,8 @@ df = utils.perform_vector_ops(df, props["vector_operations"]) df['legend'] = df['module'] for i in range(0,len(df)): - df['legend'][i] = df['legend'][i].replace("TwoMasterClocksTreeGptpShowcase.","") -# df['legend'][i] = df['legend'][i].replace(".clock[0]","") + df.loc[i, 'legend'] = df.loc[i, 'legend'].replace("TwoMasterClocksTreeGptpShowcase.","") +# df.loc[i, 'legend'] = df.loc[i, 'legend'].replace(".clock[0]","") # plot utils.plot_vectors(df, props) diff --git a/showcases/wireless/errorrate/ErrorRate.anf b/showcases/wireless/errorrate/ErrorRate.anf index dda567fef51..b4b4ab83537 100644 --- a/showcases/wireless/errorrate/ErrorRate.anf +++ b/showcases/wireless/errorrate/ErrorRate.anf @@ -1990,7 +1990,7 @@ if df.empty: for i in range(len(df['value'])): # avoid SettingWithCopyWarning value = df['value'].copy() - value[i] = float(df['bitrate'][i]) * (1 - float(df['value'][i])) + value[i] = float(df.loc[i, 'bitrate']) * (1 - float(df.loc[i, 'value'])) df['value'] = value xaxis_itervar, group_by = utils.select_xaxis_and_groupby(df, props)