Skip to content

Commit

Permalink
MAINT: Fix examples for newer pandas (mne-tools#11940)
Browse files Browse the repository at this point in the history
  • Loading branch information
larsoner authored Aug 31, 2023
1 parent a969c28 commit 99acd07
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 10 additions & 5 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,11 +1327,16 @@ def reset_warnings(gallery_conf, fname):
category=RuntimeWarning,
)
# pandas, via seaborn (examples/time_frequency/time_frequency_erds.py)
warnings.filterwarnings(
"ignore",
message=r"iteritems is deprecated.*Use \.items instead\.",
category=FutureWarning,
)
for message in (
"use_inf_as_na option is deprecated.*",
r"iteritems is deprecated.*Use \.items instead\.",
"is_categorical_dtype is deprecated.*",
):
warnings.filterwarnings(
"ignore",
message=message,
category=FutureWarning,
)
# pandas in 50_epochs_to_data_frame.py
warnings.filterwarnings(
"ignore", message=r"invalid value encountered in cast", category=RuntimeWarning
Expand Down
5 changes: 4 additions & 1 deletion tutorials/epochs/40_autogenerate_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
import matplotlib.pyplot as plt
import mne


data_dir = Path(mne.datasets.erp_core.data_path())
infile = data_dir / "ERP-CORE_Subject-001_Task-Flankers_eeg.fif"

Expand Down Expand Up @@ -240,6 +239,8 @@
# check whether the response matches the stimulation side, and add this result
# to another column.

metadata.loc[:, "stimulus_side"] = "" # initialize column

# left-side stimulation
metadata.loc[
metadata["first_stimulus"].isin(
Expand Down Expand Up @@ -356,6 +357,8 @@
# Exactly like in the previous example, we create new columns ``stimulus_side``
# and ``response_correct``.

metadata.loc[:, "stimulus_side"] = "" # initialize column

# left-side stimulation
metadata.loc[
metadata["last_stimulus"].isin(
Expand Down
1 change: 0 additions & 1 deletion tutorials/epochs/50_epochs_to_data_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@
id_vars=["condition", "epoch"], var_name="channel", value_name="latency of peak"
)
)

ax = sns.violinplot(
x="channel",
y="latency of peak",
Expand Down

0 comments on commit 99acd07

Please sign in to comment.