-1

请帮助照片是我的输出和代码的屏幕截图,我如何使用我需要通过返回的“精度分数”过滤的 best_match_score 该列仅在合并后出现(即只需返回所有内容与下面的“best_match_score ” -1.06)

import fuzzymatcher
import pandas as pd
import os

# pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)

REDCAP = pd.read_csv(r"C:\Users\Selamola\Desktop\PythonThings\FuzzyMatching\REDCAP Form A v1 and v2 23 Feb 211.csv")
covidSheet = pd.read_csv(r"C:\Users\Selamola\Desktop\PythonThings\FuzzyMatching\Cases missing REC ID 23 Feb 211.csv")

Data_merge = fuzzymatcher.fuzzy_left_join(covidSheet, REDCAP,
                                          left_on=['Participant Name', 'Particfipant Surname', 'Screening Date',
                                                   'Screening Date', 'Hospital Number', 'Alternative Hospital Number'],
                                          right_on=['Patient Name', 'Patient Surname', 'Date Of Admission',
                                                    'Date Of Sample Collection', 'Hospital Number', 'Hospital Number'])

# Merged_data = pd.merge(REDCAP, covidSheet, how='left',
#                        left_on=['Patient Name', 'Patient Surname'],
#                        right_on=['Participant Name', 'Particfipant Surname'])

# Data_merge.to_csv(r'C:\Users\Selamola\Desktop\PythonThings\FuzzyMatching\DataMacth.csv')

print(Data_merge)

工作区图片

4

1 回答 1

1

除非我遗漏了什么,否则这似乎很简单。请务必尝试阅读有关在 pandas 中切片数据的文档。

mask = Data_merge['best_match_score'] < .1.06
filtered_data = Data_merge[mask]
于 2021-02-25T17:21:02.677 回答