我有两组数据,它们有共同的要素集,但它们的ID名称有不同的标签。你知道吗
我想看看是否有一个最佳的分类器,可以帮助我选择哪些名称匹配是基于这些特征的最佳选择。你知道吗
Set 1
看起来像:
Name ID1 code1 move1 year
Highland 1 nc st 2002
Highland 4 nc st 2001
Highland gt3 nc st 2002
Highland gt2 nc st 2003
Mark wt1 ns st 2000
Mark ws1 ns st 1945
Mark ost6 nc ct 2002
Niko 1 ng ct 2000
.
.
Set 2
看起来像:
Name ID2 code2 move2 year
Highland gt1 nc st 2002
Highland gt3 nc st
Highland 2 nc st 2003
Highland gt4 nc st 2001
Mark t1 ns st 2000
Mark s1 nsi st
Mark ost6 nci ct 2002
Niko 1 ngi ct 2000
.
.
正如您所看到的,这两个集合中都有一些差异,但是Name
总是相同的-id有时几乎匹配,有时完美匹配。其他时候codes
或moves
匹配或接近,有时一组的年份一般缺失。你知道吗
我已经计算了fuzzy ratios
,它使用Levenshtein Distances
作为这些id,但它们不足以让我真正匹配。你知道吗
有更好的方法吗?你知道吗
尝试
fuzz.token_set_ratio()
而不是fuzzy.ration()
。 使用fuzz.token\u set\u比率()你会得到一个很好的匹配。你知道吗有关更多信息,请访问docs。你知道吗
相关问题 更多 >
编程相关推荐