How do you list asset IDs that occur only in a new snapshot?
setdiff1d selects distinct values in its first input that are absent from its second. Argument order sets the direction.
numpy.setdiff1d in practice
Comparing new IDs [2,3,3,5] against old IDs [2,4] yields [3,5]. Reverse the arguments to find assets that disappeared.
import numpy as np
np.setdiff1d([2,3,3,5],[2,4])Result [3, 5]
中文
怎样列出只在新快照出现的资产编号?
setdiff1d 从第一个输入中取出第二个输入没有的不同值。参数顺序定义比较方向。
numpy.setdiff1d 算例
新编号 [2,3,3,5] 对旧编号 [2,4] 得到 [3,5]。若要找退出清单的资产,把新旧交换。
import numpy as np
np.setdiff1d([2,3,3,5],[2,4])结果 [3, 5]