diff --git a/pynapple/core/time_series.py b/pynapple/core/time_series.py index 72b1b234..7c49d773 100644 --- a/pynapple/core/time_series.py +++ b/pynapple/core/time_series.py @@ -1118,8 +1118,9 @@ def __getitem__(self, key, *args, **kwargs): and all([isinstance(k, str) for k in key]) ): if all(k in self.columns for k in key): - with warnings.catch_warnings(action="ignore"): + with warnings.catch_warnings(): # ignore deprecated warning for loc + warnings.simplefilter("ignore") return self.loc[key] else: return _MetadataMixin.__getitem__(self, key) diff --git a/tests/test_time_series.py b/tests/test_time_series.py index c20d9578..4c7f05af 100755 --- a/tests/test_time_series.py +++ b/tests/test_time_series.py @@ -1389,7 +1389,8 @@ def test_deprecation_warning(self, tsdframe): tsdframe.loc[columns[0]] if isinstance(columns[0], str): # suppressed warning with getitem, which implicitly uses loc - with warnings.catch_warnings(action="error"): + with warnings.catch_warnings(): + warnings.simplefilter("error") tsdframe[columns[0]]