-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Address several numpy/pandas deprecation warnings; clean up test output #1930
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
Conversation
The version in default channel is old. Version in conda-forge is up to date and contains a fix for this deprecation warning: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
Use `unit='minutes'` instead of `unit='T'` ('T' was deprecated in pandas 2.1). Fixes: FutureWarning: Unit 'T' is deprecated and will be removed in a future version.
Fixes: FutureWarning: Series.__setitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To set a value by position, use `ser.iloc[pos] = value`
Fixes: FutureWarning: DataFrame.fillna with 'method' is deprecated and will raise in a future version. Use obj.ffill() or obj.bfill() instead.
Fixes: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise in a future error of pandas. Value '[69.43454873]' has dtype incompatible with int64, please explicitly cast to a compatible dtype first.
Fixes: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
Fixes: RuntimeWarning: invalid value encountered in multiply RuntimeWarning: invalid value encountered in scalar multiply
Fixes: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
@@ -134,6 +134,7 @@ def fn(x): | |||
return np.abs((x ** 2 - x) / 2 - n_pairs) | |||
|
|||
n_dist = np.round(scipy.optimize.fmin(fn, np.sqrt(n_pairs), disp=False)) | |||
n_dist = n_dist.item() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change needs to be checked by someone who understands the WVM code better than I do. @cwhanse?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 136 returns an array of length 1, the item
is converting to scalar. Is that correct? If so, then this looks approriate to me.
I don't think we would have triggered the error described in the numpy warning at line 145/6, since n_dist.ndim
woudl be 1. Better to be specific here, in any case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
docs/sphinx/source/reference
for API changes.docs/sphinx/source/whatsnew
for all changes. Includes link to the GitHub Issue with:issue:`num`
or this Pull Request with:pull:`num`
. Includes contributor name and/or GitHub username (link with:ghuser:`user`
).remote-data
) and Milestone are assigned to the Pull Request and linked Issue.This PR:
remote-data
tests on python 3.12 introduced in Add python 3.12 to CI #1886There is still some junk in the test CI logs but I'm inclined to leave the rest for future PRs.