Skip to content

Commit

Permalink
lisa: Address some pandas FutureWarning
Browse files Browse the repository at this point in the history
FIX

Avoid a FutureWarning related to inplace operation on view objects that
will not work anymore in pandas 3.0
  • Loading branch information
douglas-raillard-arm committed Jan 22, 2024
1 parent 97879f7 commit 955f404
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lisa/analysis/idle.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def df_cpus_idle(self, cpus=None):
# The event uses an unsigned int even though the kernel uses -1, so use
# -1 to avoid being tied to the event field type size
non_idle = (2 ** 32) -1
df['state'].replace(non_idle, -1, inplace=True)
df['state'] = df['state'].replace(non_idle, -1)
return df

@TraceAnalysisBase.cache
Expand Down
5 changes: 2 additions & 3 deletions lisa/analysis/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def f(state):
df_add_delta(df, col='duration', inplace=True)

if not np.isnan(preempted_value):
df['active'].fillna(preempted_value, inplace=True)
df['active'] = df['active'].fillna(preempted_value)

# Merge consecutive activations' duration. They could have been
# split in two by a bit of preemption, and we don't want that to
Expand All @@ -747,8 +747,7 @@ def f(state):
sleep = sleep.reindex(active.index, method='bfill')
duty_cycle = active / (active + sleep)

df['duty_cycle'] = duty_cycle
df['duty_cycle'].ffill(inplace=True)
df['duty_cycle'] = duty_cycle.ffill()

return df

Expand Down
2 changes: 1 addition & 1 deletion lisa/datautils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1446,7 +1446,7 @@ def df_combine_duplicates(df, func, output_col, cols=None, all_col=True, prune=T
except KeyError:
pass
else:
init_df[output_col].fillna(fill, inplace=True)
init_df[output_col] = df[output_col].fillna(fill)

if prune:
# Only keep the first row of each duplicate run
Expand Down
2 changes: 1 addition & 1 deletion lisa/pelt.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def simulate_pelt(activations, init=0, index=None, clock=None, capacity=None, wi
df = pd.DataFrame({'activations': activations})
if capacity is not None:
df['rel_capacity'] = capacity.reindex(df.index, method='ffill') / scale
df['rel_capacity'].bfill(inplace=True)
df['rel_capacity'] = df['rel_capacity'].bfill()

if clock is None:
# If we have the CPU capacity at hand, we can make a fake PELT clock
Expand Down
2 changes: 1 addition & 1 deletion lisa/stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def _df_stats(self):
unit_col = self._unit_col
default_unit = ''
if unit_col in df:
df[unit_col].fillna(default_unit, inplace=True)
df[unit_col] = df[unit_col].fillna(default_unit)
else:
df[unit_col] = default_unit

Expand Down

0 comments on commit 955f404

Please sign in to comment.