Issue
I tried this way:
A = np.asmatrix(np.random.rand(4,1))
B = np.asmatrix(np.random.rand(4,1))
C = np.min(A, B)
Let's A and B be as given below:
A = [[0.13456968]
[0.80465702]
[0.08426155]
[0.85041178]]
B = [[0.64932459]
[0.77806739]
[0.15517366]
[0.10992883]]
I want to have C as given below:
C = [[0.13456968]
[0.77806739]
[0.08426155]
[0.10992883]]
But this gives following error:
TypeError: only integer scalar arrays can be converted to a scalar index
Solution
You need to use minimum() instead of min():
A = np.asmatrix(np.random.rand(4,1))
B = np.asmatrix(np.random.rand(4,1))
C = np.minimum(A, B)
Answered By - alexey_zotov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.