Python Forum

Full Version: np.arrange error - no attribute
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Python novice.
I am using the Canopy Python editor.
I cannot get the arrange command to work.
----------------------------------------
import numpy as np
pp=np.arrange(10)
pp=np.arrange(1,10)
pp=np.arrange(1,10,1)

all commands give error:
AttributeError: 'module' object has no attribute 'arrange'
Tried many other combinations for argument, no luck.
Numpy has arange() function, not arrange(). Your examples should be like
pp = np.arange(10)
(Jul-01-2017, 12:44 PM)pksherard Wrote: [ -> ]all commands give error:
AttributeError: 'module' object has no attribute 'arrange'
Tried many other combinations for argument, no luck.

For future reference, the error is telling you that the function you're trying to call doesn't exist.  Moving the arguments around isn't going to change that fact... because the function isn't there, there aren't any combination of arguments which would ever be valid.