Fastest method to find A[not slice] for a numpy array

Viewed 109

What is the fastest way to access the values that are at the opposite of a particular given slice? Some code:

import numpy as np

A = np.arange(2,100000)
S = slice(79,78954,34)
A[S] #This is all the values I do NOT want. 
A[?] #All the values I want are the values in A but not in A[S], what is ?. 
1 Answers

You can also use masked arrays:

A = np.ma.array(A)
A[S] = np.ma.masked
A.compressed()
Related