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

MAINT: Pandas deprecation #3922

Merged
merged 2 commits into from Aug 23, 2023
Merged

MAINT: Pandas deprecation #3922

merged 2 commits into from Aug 23, 2023

Conversation

larsoner
Copy link
Contributor

Fixes:

...
../nilearn/nilearn/glm/first_level/design_matrix.py:236: in _convolve_regressors
    trial_type, onset, duration, modulation = check_events(events)
../nilearn/nilearn/glm/first_level/experimental_paradigm.py:114: in check_events
    .agg(STRATEGY)
...
../virtualenvs/base/lib/python3.11/site-packages/pandas/core/apply.py:1828: in warn_alias_replacement
    warnings.warn(
E   FutureWarning: The provided callable <function sum at 0x7fa1a230afc0> is currently using SeriesGroupBy.sum. In a future version of pandas, the provided callable will be used directly. To keep current behavior pass 'sum' instead.

Seems like it was available at least back to Pandas 1.4 (Jan 2022) so maybe good enough... couldn't find docs for earlier versions despite them having a drop-down 🤷‍♂️

@larsoner
Copy link
Contributor Author

Okay found the docs for 1.3 (released > 2yr ago) and it looks like .aggregate in other stuff supported strings so this is hopefully good enough

@ymzayek
Copy link
Member

ymzayek commented Aug 22, 2023

Thx @larsoner should be good if everything passes!

@github-actions
Copy link
Contributor

👋 @larsoner Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

@Remi-Gau
Copy link
Collaborator

doesn't this mean we have to bump pandas version?

"pandas>=1.1.5",

@larsoner
Copy link
Contributor Author

Looks like it was probably also supported on 1.1:

https://pandas.pydata.org/pandas-docs/version/1.1/reference/api/pandas.core.groupby.SeriesGroupBy.aggregate.html

That's not a link to the correct function because that one is just blank, but I'm assuming the API was consistent

@ymzayek
Copy link
Member

ymzayek commented Aug 22, 2023

@Remi-Gau we will anyways for release 0.11 in January. At the moment it doesn't seem we have to do it sooner

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Merging #3922 (d6c942d) into main (0d70562) will decrease coverage by 0.01%.
Report is 2 commits behind head on main.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3922      +/-   ##
==========================================
- Coverage   91.73%   91.73%   -0.01%     
==========================================
  Files         134      134              
  Lines       15738    15737       -1     
  Branches     3275     3275              
==========================================
- Hits        14437    14436       -1     
  Misses        758      758              
  Partials      543      543              
Flag Coverage Δ
macos-latest_3.10 91.64% <100.00%> (-0.01%) ⬇️
macos-latest_3.11 91.64% <100.00%> (-0.01%) ⬇️
macos-latest_3.8 91.60% <100.00%> (-0.01%) ⬇️
macos-latest_3.9 91.60% <100.00%> (-0.01%) ⬇️
ubuntu-latest_3.10 91.64% <100.00%> (-0.01%) ⬇️
ubuntu-latest_3.11 91.64% <100.00%> (-0.01%) ⬇️
ubuntu-latest_3.8 91.60% <100.00%> (-0.01%) ⬇️
ubuntu-latest_3.9 91.60% <100.00%> (-0.01%) ⬇️
windows-latest_3.10 91.58% <100.00%> (-0.01%) ⬇️
windows-latest_3.11 91.58% <100.00%> (-0.01%) ⬇️
windows-latest_3.8 91.55% <100.00%> (-0.01%) ⬇️
windows-latest_3.9 91.55% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
nilearn/glm/first_level/experimental_paradigm.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thx.

@ymzayek
Copy link
Member

ymzayek commented Aug 23, 2023

Thanks @larsoner, merging

@ymzayek ymzayek merged commit 2b3dea0 into nilearn:main Aug 23, 2023
29 checks passed
@larsoner larsoner deleted the dep branch August 23, 2023 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants