Working on an Excel file and looking to find out accuracy percentage by matching values from another sheet using an dataframe. Matching other column values using one column having unique values.
I have tried using Fuzzy match / any other possible method but didn't worked
Input Data: Sheet 1:
identity_no address Pincode company_name
IN2231 Delhi, Indi 110030 AXN pvt Ltd
UK654 London, Uk 897653 Aviva Intl Ltd
SL1432 Colombo, Srilanka 07658 Ship Incorporations
LK0678 Libya, Sns 5674332 Oppo Mobiles pvt ltd
Master Data Sheet 2
identity_no address Pincode company_name
IN2231 Delhi, India 110030 AXN pvt Ltd
UK654 London, Uk 897653 Aviva Intl Ltd
SL1432 Colombo, Srilanka 07658 Ship Incorporations
Expected Output:
identity_no address Pincode company_name match_percent
IN2231 Delhi, Indi 110030 AXN pvt Ltd
UK654 London, Uk 897653 Aviva Intl Ltd
SL1432 Colombo, Srilanka 07658 Ship Incorporations
LK0678 Libya, Sns 5674332 Oppo Mobiles pvt ltd
Code i have tried so far:
df = pd.read_excel(open(r'input.xlsx', 'rb'), sheet_name='sheet1')
df2 = pd.read_excel(open(r'master_data.xlsx', 'rb'), sheet_name='sheet2')
for index, row in df.iterrows():
for index_config, val_new in df2.iterrows():
if row['identity_no '] == row_config['identity_no']:
df[['identity_no','address', 'Pincode', 'company_name']][Index] = val_config[['identity_no','address', 'Pincode', 'company_name']]
Here mapping the values from sheet2 to sheet1 but i am also looking to find out the accuracy of the matching on How accurately the columns have been matched.
Any Suggestions.