0

For the list p I cannot append numpy values. Error message and Code is given below.

enter image description here

I will be thankful for any help.

1
  • 2
    This code is really awkward. There are pointless operations like the asscalar calls, or building lists where you don't need them. You recompute np.argmax(output, axis=2) over and over, too. NumPy code should almost never involve list comprehensions. Commented Jan 31, 2017 at 23:15

2 Answers 2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You reused the p variable:

p = []
...
    value = [p for p in X.T[index]]
#                  ^

Pick a different name.

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.