python - Pythonista way of extracting elements from an array -
I am writing some python lines of code that do the following:
I have two arrays And in B, B (full strictly) increasing integers are not included.
I want to extract from those values for which the value of b is greater than 20, but I do not want that duplicate, if B has values: ..., 40,40,41 , ... I just do not want the first value equal to 40 to the other.
This is the reason that a [b% 20 == 0]
does not work.
I am using:
factor = [20 * i in xrange (1, for factors in int factors [0] [0] [0] [ 0] [0] [0] [0] [0] [0] [0] [/]>
-text "itemprop =" text ">
a [(b% 20 == 0 ) & Amp; Np.r_ [true, npdiiff (b)> gt;]
b% 20 == 0
div gives a binary mask Which selects all the elements of B, which is the factor of 20. NPR_ [true, np df (b) gt; 0]
makes a binary mask that only elements Which separates from the previous element (we obviously add a truth in the beginning, because there is no previous element in the first element). Add masks together and add voice!
Comments
Post a Comment