Skip to content

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 N
import numpy as np

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.

xpd has no automatic fix. Because every use of the old name changes with the import. Make the change by hand.

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.