scipy/legacy-api
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| SciPy | info | safe, with xpd check --fix |
All versions |
SciPy keeps these names only for old code. Use the replacement that the message names.
totals = ndimage.sum(image, labels, index)stat, p = stats.ranksums(x, y)totals = ndimage.sum_labels(image, labels, index)u, p = stats.mannwhitneyu(x, y, use_continuity=False, method="asymptotic")What the rule reports
Section titled “What the rule reports”The rule reports names that SciPy keeps for old code:
| Name | What SciPy says | Write instead |
|---|---|---|
ndimage.sum |
kept for backwards compatibility | ndimage.sum_labels |
stats.ranksums |
legacy | stats.mannwhitneyu, which gives the same p-value and the U statistic in place of z |
How to fix it
Section titled “How to fix it”xpd check --fix applies the fix of this rule.
The safe fix writes ndimage.sum_labels for ndimage.sum, whose body only calls sum_labels. The other forms have no fix.
Diagnostic message
Section titled “Diagnostic message”SciPy keeps ndimage.sum only for backwards compatibility and asks new code to use sum_labels. Write ndimage.sum_labels.See all rules in the SciPy pack.