Issue
I have an array from which I want to get the indices of the elements of interest by condition np.where:
diff = [19, 403472, 403491, 403491, 403491, 403491, 13, 403478, 13]
np.where(diff > np.average(diff))
As result I have tuple:
(array([1, 2, 3, 4, 5, 7], dtype=int64),)
But I want only array:
array([1, 2, 3, 4, 5, 7]
And list() don't help.
Can you please help? Thanks.
Solution
np.where(diff > np.average(diff))[0]
?
output:
array([1, 2, 3, 4, 5, 7])
Answered By - JayPeerachai
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.