From 64e402bd9d0ca530dc7c0dd50e09443cfd2e4bf9 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Thu, 19 Dec 2024 14:48:01 -0500 Subject: [PATCH] FIX: Min --- mne/utils/dataframe.py | 15 +++------------ pyproject.toml | 2 +- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/mne/utils/dataframe.py b/mne/utils/dataframe.py index 0511433001d..43c680727e2 100644 --- a/mne/utils/dataframe.py +++ b/mne/utils/dataframe.py @@ -4,8 +4,6 @@ # License: BSD-3-Clause # Copyright the MNE-Python contributors. -from inspect import signature - import numpy as np from ..defaults import _handle_default @@ -51,21 +49,14 @@ def _convert_times(times, time_format, meas_date=None, first_time=0): def _inplace(df, method, **kwargs): - # Handle transition: inplace=True (pandas <1.5) → copy=False (>=1.5) - # and 3.0 warning: - # E DeprecationWarning: The copy keyword is deprecated and will be removed in a - # future version. Copy-on-Write is active in pandas since 3.0 which utilizes a - # lazy copy mechanism that defers copies until necessary. Use .copy() to make - # an eager copy if necessary. _meth = getattr(df, method) # used for set_index() and rename() + # TODO: deprecation in Pandas 3.0, can remove once we require 3+ if check_version("pandas", "3.0"): return _meth(**kwargs) - elif "copy" in signature(_meth).parameters: - return _meth(**kwargs, copy=False) else: - _meth(**kwargs, inplace=True) - return df + # "copy" in signature(_meth).parameters + return _meth(**kwargs, copy=False) @verbose diff --git a/pyproject.toml b/pyproject.toml index ace765af47a..3626da6f3df 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,7 +111,7 @@ full-no-qt = [ "nilearn", "numba", "openmeeg >= 2.5.5", - "pandas", # >= 1.4 + "pandas", # >= 1.5 "pillow", # for `Brain.save_image` and `mne.Report` "pyarrow", # only needed to avoid a deprecation warning in pandas "pybv",