Hi, I have been banging my head against the wall - I know I can get rid of for-loop here, but can't figure out how. Please help! I suspect I can do np.sum on the whole adGroup but I am lacking the imagination to visualize it.
for ind in range(adGroup.shape[0]): row = adGroup.iloc[ind, :] current_hashes, current_cf_id = adArrayHashes[row['hash_seq_array'].astype(int)], [row['cf_id']] # calculaton hashes_diff = np.array(list(map(lambda x: np.sum(np.not_equal(start_hashes[x:x + len(current_hashes)], current_hashes), axis=1), range(58) ))) hashes_diff_scores = np.sum(hashes_diff <= IMG_DIFFER, axis=1) hashes_diff_mask = hashes_diff_scores >= SEQ_THRESHOLD if any(hashes_diff_mask): presumptive_cf_ids.append(current_cf_id[0]) presumptive_scores.append(max(hashes_diff_scores)) if queue != 0: queue.put((presumptive_cf_ids, presumptive_scores)) # return presumptive_cf_ids, presumptive_scores return Sent from Outlook<http://aka.ms/weboutlook> -- https://mail.python.org/mailman/listinfo/python-list