How can a membership check preserve transaction positions?
isin tests each input element for membership and returns a mask in the original shape.
numpy.isin in practice
Screen tags A,C,A against allowed tags and both occurrences of A retain their positions. Normalize account identity and chain context before comparing real addresses.
import numpy as np
np.isin(['A','C','A'], ['A','B'])Result [true, false, true]
中文
如何保留白名单中每笔交易的原始位置?
isin 为输入每个元素给出是否属于候选集合的真假值,结果形状与输入一致。
numpy.isin 算例
地址标签 A、C、A 逐笔核对许可名单,两个 A 的位置都会保留。真实地址需先统一标识和链上下文。
import numpy as np
np.isin(['A','C','A'], ['A','B'])结果 [true, false, true]