python - How to find the index of an array inside a list -


Assume that you have an array list and then you specify separately (which is also present inside the list ). How can you get an indicator?

 In  [185]: y_train.index (Y_test [0]) ------------------- ------- ------------------------------------------- ------ Manor Tracebacks (Last Call Last) & lt; Ipython-input-185-c9084f698632 & gt; In & lt; Module & gt; () ---- & gt; 1 y_train.index (Y_test [0]) Value error: The truth value of an array with more than one element is ambiguous. Use A.any () or a.all ()  

, y_train is a 'big' list that contains everything, and Y_test [ 0] is one of its elements

  In the category I (0, Lane (Y_train): For range in J (0, Lane (Y_test)): If y_train [i] .shape == Y_test [j] .shape: v = y_train [i] == Y_test [j] if v .all (): Print ('I', I) Print ('J', J)  

It is indexed that I am after that. The error has come from the fact that it is not clear what should be the truth when working with the arrays of many elements


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -