numpy/numpy-import-alias
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| NumPy | info | none, edit by hand | All versions |
NumPy's docs import it as np, and other code and the fixes of this pack expect that name. Write import numpy as np.
import numpy as Nimport numpy as npWhat the rule reports
Section titled “What the rule reports”The rule reports import numpy as <name> with a name other than np or xp, and from numpy import *, which replaces Python's sum, min, max, round, abs, all and any.
How to fix it
Section titled “How to fix it”xpd has no automatic fix. Because every use of the old name changes with the import. Make the change by hand.
Diagnostic message
Section titled “Diagnostic message”NumPy's docs import it as np, and other code and the fixes of this pack expect that name. Write import numpy as np.See all rules in the NumPy pack.