Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make test compatible with future pandas #11625

Merged
merged 2 commits into from
Apr 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions mne/time_frequency/tests/test_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ def _agg_helper(df, weights, group_cols):
return Series(_df)


# TODO: Fix this warning
@pytest.mark.filterwarnings("ignore:.*columns to operate on.*:FutureWarning")
@pytest.mark.parametrize('long_format', (False, True))
@pytest.mark.parametrize('method, output', [
('welch', 'complex'),
Expand Down Expand Up @@ -176,8 +174,8 @@ def test_unaggregated_spectrum_to_data_frame(raw, long_format, method, output):
# sorting at the agg step *sigh*
_inplace(orig_df, 'sort_values', by=grouping_cols, ignore_index=True)
# aggregate
gb = df.drop(columns=drop_cols).groupby(
grouping_cols, as_index=False, observed=False)
df = df.drop(columns=drop_cols)
gb = df.groupby(grouping_cols, as_index=False, observed=False)
if method == 'welch':
if output == 'complex':
def _fun(x):
Expand All @@ -186,6 +184,7 @@ def _fun(x):
_fun = np.nanmean
agg_df = gb.aggregate(_fun)
else:
gb = gb[df.columns] # https://github.com/pandas-dev/pandas/pull/52477
agg_df = gb.apply(_agg_helper, spectrum._mt_weights, grouping_cols)
# even with check_categorical=False, we know that the *data* matches;
# what may differ is the order of the "levels" in the *metadata* for the
Expand Down