I have a 2D array like this: a = np.array([[25, 83, 18, 71], [75, 7, 0, 85], [25, 83, 18, 71], [25, 83, 18, 71], [75, 48, 8, 43], [ 7, 47, 96, 94], [ 7, 47, 96, 94], [56, 75, 50, 0], [19, 49, 92, 57], [52, 93, 58, 9]]) and I want to […]

- Tags -48, :, :]).any(-1).all(0)] '''def remove_nploop(data): a, 'a2':a2, 'a3':a3, 'a4':a4, 'B': [2 ** k for k in range(11, 'B': kernels[:3]}[figure], 'B':'Testing removal of large dataset'}[figure], 'B')] fig = plt.figure(figsize=(20, 'b1':b1, 'b3':b3, 'b4':b4, 'equality_check': lambda x, 'kernels': {'A': kernels, 'm1':m1, 'm2':m2, 'm3':m3, 'm4':m4} ravel_a = ne.evaluate('(a1-m1)+(a2-m2)*s1+(a3-m3)*s1*s2+(a4-m4)*s1*s2*s3', 'n_range': {'A': [2 ** k for k in range(12)], 'show_progress': False, 'title' : {'A':'Testing removal of small dataset', 'xlabel': 'Remowing n rows from n rows', "71", "s3", [ 75, ['s2', [56, 0, 1, 18, 19, 20)) for i in range(len(outs)): ax = fig.add_subplot(2, 25, 25)]}[figure], 4)) a2 = a1[np.random.randint(x, 43, 47, 49, 50, 52, 57, 57]]) Update The fastest approach is dimensionality reduction but it requires quite strict limitations of ranges of columns in general. The, 58, 7, 71]]) What is the most efficient way to do this in numpy or pandas? Expected output: np.array([[75, 8, 83, 85, 9, 9]]) and I want to remove rows that has specific values, 92, 93, 94, 96, a.tolist())) b_map = set(map(tuple, A2, a2 def build_args(figure): kernels = [remove_reducedim, A3, a4 = a.T b1, arr, axis=(0, axis=0) m, axis=0) m1, axis=0) mb, axis=0) ravel_a = np.ravel_multi_index((a-m).T, axis=0) s1, axis=1)] return a''' def remove_looped(data): a, B, b = a.astype(np.int64), b = data a, b = data dfa, b = data for arr in b: a = a[np.all(~np.equal(a, b = data return a[(a[None, b = data to_remain = [True]*len(a) a_map = list(map(tuple, b = data to_remain = [True]*len(a) ind = 0 for vec_a in a: for vec_b in b: if np.array_equal(vec_a, b.astype(np.int64) #make sure box is not too small ma, b.tolist())) for i in range(len(a)): to_remain[i] = not(a_map[i] in b_map) return a[to_remain] def remove_reducedim(data):, b2, b2=b2, b3, b4 = b.T d = {'a1':a1, d) ravel_b = ne.evaluate('(b1-m1)+(b2-m2)*s1+(b3-m3)*s1*s2+(b4-m4)*s1*s2*s3', d) return a[~np.isin(ravel_a, dfb = pd.DataFrame(a), for example: b = np.array([[56, how='left', I have a 2D array like this: a = np.array([[25, i+1) ax.grid(True, indicator=True)\ .query('_merge == "left_only"').drop(columns='_merge').values def remove_smalldata(data): a, M - m + 1) ravel_b = np.ravel_multi_index((b-m).T, M - m + 1) return a[~np.isin(ravel_a, M = np.min([ma, m2, M2-m2+1, m3, M3-m3+1, M4 = np.max([MA, m4 = np.min([ma, M4-m4+1 a1, MA = np.min(a, Mb, MB = np.min(b, None, np.max([MA, np.max(a, np.max(b, pd.DataFrame(b) return dfa.merge(dfb, ravel_b)] def remove_reducedim_boost(data): a, ravel_b)] def setup(x): a1 = np.random.randint(50000, remove_looped, remove_looped_boost, remove_pd, remove_reducedim_boost, remove_smalldata] return {'setup': setup, s1)(s1, s2)(s2, s3)(s3, s4 = M1-m1+1, size=x)] return a1, sizeX, time()-t) Output: Overall testing time: 529.2596168518066, vec_b): to_remain[ind] = False break ind += 1 return a[to_remain] def remove_looped_boost(data):, which="both") outs[i].plot() plt.show() print('Overall testing time:', y: np.array_equal(x, y)} t = time() outs = [perfplot.bench(**build_args(n)) for n in ('A'