import pandas as pd
from fuzzywuzzy import process
# 示例数据
data1 = pro_R['楼盘(项目)名']
data2 = pro_G['备案名']
# 转换为DataFrame
df1 = pd.DataFrame(data1)
df2 = pd.DataFrame(data2)
# 进行模糊匹配
BA_matches = []
for index1, row1 in df1.iterrows():
match, score, _ = process.extractOne(row1['楼盘(项目)名'], df2['备案名'])
if score > 80: # 设置相似度阈值
BA_matches.append({"R系统项目名": row1['楼盘(项目)名'], "项目备案名": match, "相似度分数": score})
# 输出匹配结果列表
print(BA_matches)
import pandas as pd
# 创建DataFrame
df_matches_BA = pd.DataFrame(BA_matches)
# 打印结果
print(df_matches_BA)
# 输出结果
df_matches_BA.to_excel( 'C:\\Users\\ .xlsx')
05-16
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-30
1180
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)