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

Issue futurewarning #407

Merged
merged 7 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 4 additions & 2 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ The rules for this file:
* accompany each entry with github issue/PR number (Issue #xyz)
* release numbers follow "Semantic Versioning" https://semver.org

09/19/2024 orbeckst
09/19/2024 orbeckst, jaclark5

* 2.4.1

Fixes
- [doc] tutorial: use alchemlyb.concat (PR #399)

- Resolve pandas FutureWarnings in bar_.py and mbar_.py (issue #408 PR #407)


09/17/2024 jaclark5, orbeckst

Expand All @@ -32,6 +33,7 @@ Enhancements
Changes
- modernize build system: replaced setup.py,cfg with pyproject.toml (#385)


08/24/2024 xiki-tempula

* 2.3.2
Expand Down
19 changes: 16 additions & 3 deletions src/alchemlyb/estimators/bar_.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def fit(self, u_nk):
# group u_nk by lambda states
groups = u_nk.groupby(level=u_nk.index.names[1:])
N_k = [
(len(groups.get_group(i)) if i in groups.groups else 0)
(
len(groups.get_group(i if isinstance(i, tuple) else (i,)))
if i in groups.groups
else 0
)
for i in u_nk.columns
]

Expand All @@ -119,12 +123,21 @@ def fit(self, u_nk):
continue

# get us from lambda step k
uk = groups.get_group(self._states_[k])
uk = groups.get_group(
self._states_[k]
if isinstance(self._states_[k], tuple)
else (self._states_[k],)
)
# get w_F
w_f = uk.iloc[:, k + 1] - uk.iloc[:, k]

# get us from lambda step k+1
uk1 = groups.get_group(self._states_[k + 1])
uk1 = groups.get_group(
self._states_[k + 1]
if isinstance(self._states_[k + 1], tuple)
else (self._states_[k + 1],)
)

# get w_R
w_r = uk1.iloc[:, k] - uk1.iloc[:, k + 1]

Expand Down
6 changes: 5 additions & 1 deletion src/alchemlyb/estimators/mbar_.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ def fit(self, u_nk):

groups = u_nk.groupby(level=u_nk.index.names[1:])
N_k = [
(len(groups.get_group(i)) if i in groups.groups else 0)
(
len(groups.get_group(i if isinstance(i, tuple) else (i,)))
if i in groups.groups
else 0
)
for i in u_nk.columns
]
self._states_ = u_nk.columns.values.tolist()
Expand Down
Loading