Answer by sshashank124 for numpy.ndarray as Dictionary value
You should use np.array_equal:S = np.zeros((3,3), dtype=int)if any(np.array_equal(S, i) for i in myDict.values()): print "Yes!"else: print "Sorry. No."[OUTPUT]Sorry. No.
View Articlenumpy.ndarray as Dictionary value
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...
View Article
More Pages to Explore .....