def execute(self): array_out = np.empty() temp_in = self.original for kk, kk_value in np.ndenuerate(array): ta = np.empty(); for jj, jj_value in np.ndenumerate(array): ta = np.concatenate(ta, temp_in[ac_ind[kk], route_ind[jj]]) array_out = np.concatenate(array_out, ta) self.filtered = array_out