From de1d2ee9d2439d2c0b72927603ae0acd65866a49 Mon Sep 17 00:00:00 2001 From: Johannes Mueller Date: Thu, 10 Oct 2024 15:49:38 +0200 Subject: [PATCH] Filter FutureWarning to accommodate python-3.8 Signed-off-by: Johannes Mueller --- .../stress/collective/load_collective.py | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/pylife/stress/collective/load_collective.py b/src/pylife/stress/collective/load_collective.py index 6c9111f2..30afcb9d 100644 --- a/src/pylife/stress/collective/load_collective.py +++ b/src/pylife/stress/collective/load_collective.py @@ -17,14 +17,17 @@ __author__ = "Johannes Mueller" __maintainer__ = __author__ -from .abstract_load_collective import AbstractLoadCollective -from .load_histogram import LoadHistogram +import warnings import pandas as pd import numpy as np from pylife import PylifeSignal +from .abstract_load_collective import AbstractLoadCollective +from .load_histogram import LoadHistogram + + @pd.api.extensions.register_dataframe_accessor('load_collective') class LoadCollective(PylifeSignal, AbstractLoadCollective): """A Load collective. @@ -364,12 +367,15 @@ def make_histogram(group): if axis is None: return LoadHistogram(make_histogram(range_mean)) - result = pd.Series( - range_mean.groupby(self._levels_from_axis(axis)) - .apply(make_histogram) - .stack(['range', 'mean'], future_stack=True), - name="cycles", - ) + # TODO: Warning filter can be dropped as soon as python-3.8 support is dropped + with warnings.catch_warnings(): + warnings.simplefilter("ignore", category=FutureWarning) + result = pd.Series( + range_mean.groupby(self._levels_from_axis(axis)) + .apply(make_histogram) + .stack(['range', 'mean']), + name="cycles", + ) return LoadHistogram(result)