Numpy.delete Changing Arrays Of Floats To Strings
I'm using the numpy.delete function to remove elements from several arrays. I started from this question Make this simple for/if block more pythonic and arrived, after applying the
Solution 1:
If you are going to use numpy, you are going to be better off converting your lists to arrays. It would look something like:
a = np.array(a)
b = np.array(b)
c = np.array(c)
mask = (b > max_limit) | (c > max_limit)
a = a[mask]
b = b[mask]
c = c[mask]
>>> a
array(['c', 'f', 'g', 'i'],
dtype='|S1')
>>> b
array([ 1., 784., 43., 2.])
>>> c
array([ 32., 7., 2., 23.])
Post a Comment for "Numpy.delete Changing Arrays Of Floats To Strings"