Quantcast
Channel: numpy.ndarray as Dictionary value - Stack Overflow
Viewing all articles
Browse latest Browse all 2

numpy.ndarray as Dictionary value

$
0
0

I am storing numpy.ndarray as a value of a dictionary. My dictionary looks like:

{0: array([[ 1,  0, -1],   [ 0, -1,  0],   [ 1,  0,  0]])}

But when I am trying to find out if array exists in the dictionary using the following command

S = np.zeros((3,3), dtype=int)if S in myDict.values():   print "something"

I am getting the following error:

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

I have seen some one who have this problem, but their situation is different. Can anybody help me get ouf it?

At least any suggestion to check if a value exist in Dictionary? Thank you in advance.


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images