From 2a7621fd0d20ef09e6577eda2ffa057ec9d4ab9c Mon Sep 17 00:00:00 2001 From: Douglas Raillard Date: Tue, 19 Sep 2023 12:44:25 +0100 Subject: [PATCH] lisa: Remove use of pandas.Series.fillna(method=...) FIX fillna(method=...) parameter has beeen deprecated, so use the ffill()/bfill() equivalent instead. --- lisa/analysis/frequency.py | 2 +- lisa/analysis/idle.py | 4 ++-- lisa/analysis/tasks.py | 2 +- lisa/datautils.py | 2 +- lisa/tests/scheduler/eas_behaviour.py | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lisa/analysis/frequency.py b/lisa/analysis/frequency.py index 0df9414ee..6f7de6d3e 100644 --- a/lisa/analysis/frequency.py +++ b/lisa/analysis/frequency.py @@ -214,7 +214,7 @@ class FrequencyAnalysis(TraceAnalysisBase): # freq_active[t] == 0 otherwise cluster_freqs = cluster_freqs.join( cluster_active.to_frame(name='active'), how='outer') - cluster_freqs.fillna(method='ffill', inplace=True) + cluster_freqs.ffill(inplace=True) # Compute total time by integrating the square wave time_df['active_time'] = pd.Series({ diff --git a/lisa/analysis/idle.py b/lisa/analysis/idle.py index cb97054d7..8a08b5a65 100644 --- a/lisa/analysis/idle.py +++ b/lisa/analysis/idle.py @@ -118,7 +118,7 @@ class IdleAnalysis(TraceAnalysisBase): how='outer' ) - active.fillna(method='ffill', inplace=True) + active.ffill(inplace=True) # There might be NaNs in the signal where we got data from some CPUs # before others. That will break the .astype(int) below, so drop rows # with NaN in them. @@ -215,7 +215,7 @@ class IdleAnalysis(TraceAnalysisBase): if cpu in cluster } cpus_df = pd.DataFrame(cols, index=idle_df.index) - cpus_df.fillna(method='ffill', inplace=True) + cpus_df.ffill(inplace=True) # Ensure accurate time-based sum of state deltas. This will extrapolate # the known cluster_state both to the left and the right. diff --git a/lisa/analysis/tasks.py b/lisa/analysis/tasks.py index f2c1b8ca0..a0daaeab0 100644 --- a/lisa/analysis/tasks.py +++ b/lisa/analysis/tasks.py @@ -748,7 +748,7 @@ class TasksAnalysis(TraceAnalysisBase): duty_cycle = active / (active + sleep) df['duty_cycle'] = duty_cycle - df['duty_cycle'].fillna(inplace=True, method='ffill') + df['duty_cycle'].ffill(inplace=True) return df diff --git a/lisa/datautils.py b/lisa/datautils.py index 800cad944..029196c9b 100644 --- a/lisa/datautils.py +++ b/lisa/datautils.py @@ -1419,7 +1419,7 @@ def df_combine_duplicates(df, func, output_col, cols=None, all_col=True, prune=T # Assign the group ID to each member of the group df.loc[first_duplicates, 'duplicate_group'] = first_duplicates.loc[first_duplicates].index - df.loc[duplicates, 'duplicate_group'] = df.loc[duplicates, 'duplicate_group'].fillna(method='ffill') + df.loc[duplicates, 'duplicate_group'] = df.loc[duplicates, 'duplicate_group'].ffill() # For some reasons GroupBy.apply() will raise a KeyError if the index is a # Float64Index, go figure ... diff --git a/lisa/tests/scheduler/eas_behaviour.py b/lisa/tests/scheduler/eas_behaviour.py index 6809b692a..d28e25b23 100644 --- a/lisa/tests/scheduler/eas_behaviour.py +++ b/lisa/tests/scheduler/eas_behaviour.py @@ -289,7 +289,7 @@ class EASBehaviour(RTATestBundle, TestBundle): for task, wlgen_task in rtapp_profile.items() ) df = pd.DataFrame(cols) - df.fillna(method='ffill', inplace=True) + df.ffill(inplace=True) df.dropna(inplace=True) # Ensure the index is refitted so that integrals work as expected @@ -315,7 +315,7 @@ class EASBehaviour(RTATestBundle, TestBundle): task_cpu(task_ids[0]) for task, task_ids in self.rtapp_task_ids_map.items() )) - df.fillna(method='ffill', inplace=True) + df.ffill(inplace=True) df.dropna(inplace=True) df = df_deduplicate(df, consecutives=True, keep='first') @@ -472,7 +472,7 @@ class EASBehaviour(RTATestBundle, TestBundle): df = pd.concat([task_utils_df, task_cpu_df], axis=1, keys=['utils', 'cpus']) - df = df.sort_index().fillna(method='ffill').dropna() + df = df.sort_index().ffill().dropna() # Now make a DataFrame with the estimated power at each moment. def est_power(row): -- GitLab