Skip to content
New issue

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

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

Already on GitHub? # to your account

Issue futurewarning #407

Merged
merged 7 commits into from
Sep 19, 2024
Merged

Conversation

jaclark5
Copy link
Contributor

@jaclark5 jaclark5 commented Sep 19, 2024

Fixes #408, by adapting code to resolve pandas FutureWarnings:

 [alchemlyb/src/alchemlyb/estimators/bar_.py:100](alchemlyb/src/alchemlyb/estimators/bar_.py:100): FutureWarning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass `(name,)` instead of `name` to silence this warning.
  (len(groups.get_group(i)) if i in groups.groups else 0)
[alchemlyb/src/alchemlyb/estimators/bar_.py:122](alchemlyb/src/alchemlyb/estimators/bar_.py:122): FutureWarning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass `(name,)` instead of `name` to silence this warning.
  uk = groups.get_group(self._states_[k])
[alchemlyb/src/alchemlyb/estimators/bar_.py:127](alchemlyb/src/alchemlyb/estimators/bar_.py:127): FutureWarning: When grouping with a length-1 list-like, you will need to pass a length-1 tuple to get_group in a future version of pandas. Pass `(name,)` instead of `name` to silence this warning.
  uk1 = groups.get_group(self._states_[k + 1])

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.78%. Comparing base (aba3671) to head (0b718ea).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #407   +/-   ##
=======================================
  Coverage   98.78%   98.78%           
=======================================
  Files          28       28           
  Lines        1978     1978           
  Branches      435      435           
=======================================
  Hits         1954     1954           
  Misses          2        2           
  Partials       22       22           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@orbeckst orbeckst self-assigned this Sep 19, 2024
@orbeckst orbeckst mentioned this pull request Sep 19, 2024
Copy link
Member

@orbeckst orbeckst left a comment

Choose a reason for hiding this comment

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

thanks for the fix.

(looks a bit uglier than it used to but if this what pandas wants...)

@orbeckst
Copy link
Member

Let's include this fix in the 2.4.1 release #403

@jaclark5
Copy link
Contributor Author

jaclark5 commented Sep 19, 2024

thanks for the fix.

(looks a bit uglier than it used to but if this what pandas wants...)

@orbeckst The alternative is to have all lambda states be represented as tuples. so instead of:
u_nk.columns.tolist()
> [0, 0.25, 0.5, 0.75, 1.0]
it will have to be:
u_nk.columns.tolist()
> [(0,), (0.25,), (0.5,), (0.75,), (1.0,)]

@orbeckst orbeckst merged commit 187246e into alchemistry:master Sep 19, 2024
8 checks passed
@orbeckst
Copy link
Member

Thanks @jaclark5 !

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pandas FutureWarning Cluttering output
2 participants