Skip to content

Commit

Permalink
FIX: Min
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner committed Dec 19, 2024
1 parent 63ec69e commit 64e402b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
15 changes: 3 additions & 12 deletions mne/utils/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 64e402b

Please sign in to comment.