Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
For the list p I cannot append numpy values. Error message and Code is given below.
I will be thankful for any help.
asscalar
np.argmax(output, axis=2)
You accidentally reused p as an iterator in the line:
value = [p for p in X.T[index]]
so p was reassigned as a numpy.int32 instead of a list.
Add a comment
You reused the p variable:
p
p = [] ... value = [p for p in X.T[index]] # ^
Pick a different name.
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
asscalarcalls, or building lists where you don't need them. You recomputenp.argmax(output, axis=2)over and over, too. NumPy code should almost never involve list comprehensions.