I'm learning to use Python but I have a problem with NumPy.
If I run this code:
pr1=np.array(([1,1,1,1,1],[2,2,2,2,2]))
pr2=np.array(([3,1,1,1,1],[4,2,2,2,2]))
pr3=np.stacks((pr1,pr2),axis=3).shape
Python returns me this error:
AttributeError: module 'numpy' has no attribute 'stacks'
I have just checked the numpy version running
print(np.version.version)
and it returns 1.20.1 which I think is the latest version.
I have used the module stack just this morning and it worked, so I can't understand what is happened...
CodePudding user response:
You used stacks
instead of stack
.
Here you have the documentation for stack
attribute
CodePudding user response:
That's a good question. I recommend searching online to try to understand what every error is trying to tell you. In this case, the error AttributeError is warning that 'stacks' is not an attribute of numpy.
Searching online for 'numpy stacks', i only found the attribute 'stack'. You could then try using 'stack' instead of 'stacks' and see if this solves your problem.