Skip to main content

A package for the matching of company names

Project description

name_matching

Name matching

Name matching is a Python package for the matching of company names. This package has been developed to match the names of companies from different databases together to allow them to be merged. The package has a number of options to determine how exact the matches should be and also for the selection of different name matching algorithms.

For a more in-depth discussion of the name matching package please see the company name matching medium post

Installation

The package can be installed via PiPy:

pip install name_matching

Alternatively you could install the package by downloading the repo, navigating to the folder and run the setup in pip locally

pip install .

Usage

To see example usage of the package you can use the notebook folder. An example of the usage is also given below

import pandas as pd
from name_matching.name_matcher import NameMatcher

# define a dataset with bank names
df_companies_a = pd.DataFrame({'Company name': [
        'Industrial and Commercial Bank of China Limited',
        'China Construction Bank',
        'Agricultural Bank of China',
        'Bank of China',
        'JPMorgan Chase',
        'Mitsubishi UFJ Financial Group',
        'Bank of America',
        'HSBC',
        'BNP Paribas',
        'Crédit Agricole']})

# alter each of the bank names a bit to test the matching
df_companies_b = pd.DataFrame({'name': [
        'Bank of China Limited',
        'Mitsubishi Financial Group',
        'Construction Bank China',
        'Agricultural Bank',
        'Bank of Amerika',
        'BNP Parisbas',
        'JP Morgan Chase',
        'HSCB',
        'Industrial and Commercial Bank of China',
        'Credite Agricole']})

# initialise the name matcher
matcher = NameMatcher(number_of_matches=1, 
                      legal_suffixes=True, 
                      common_words=False, 
                      top_n=50, 
                      verbose=True)

# adjust the distance metrics to use
matcher.set_distance_metrics(['bag', 'typo', 'refined_soundex'])

# load the data to which the names should be matched
matcher.load_and_process_master_data(column='Company name',
                                     df_matching_data=df_companies_a, 
                                     transform=True)

# perform the name matching on the data you want matched
matches = matcher.match_names(to_be_matched=df_companies_b, 
                              column_matching='name')

# combine the datasets based on the matches
combined = pd.merge(df_companies_a, matches, how='left', left_index=True, right_on='match_index')
combined = pd.merge(combined, df_companies_b, how='left', left_index=True, right_index=True)

Contributing

All contributions are welcome. For more substantial changes, please open an issue first to discuss what you would like to change.

License

The code is licensed under the MIT/X license an extended version of the licence: MIT

Thanks

Thanks to the work of implementing name matching algorithms done in the Abydos package. These form the basis of the name matching algorithms used in this package.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

name_matching-0.9.22.tar.gz (93.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

name_matching-0.9.22-py3-none-any.whl (139.2 kB view details)

Uploaded Python 3

File details

Details for the file name_matching-0.9.22.tar.gz.

File metadata

  • Download URL: name_matching-0.9.22.tar.gz
  • Upload date:
  • Size: 93.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for name_matching-0.9.22.tar.gz
Algorithm Hash digest
SHA256 fc16480c1da2fbbb857b0b9dd190fc53c5221a2d6177cf186c8cf2f733d04062
MD5 e4907b3467edd5d6a80737be7d5711e7
BLAKE2b-256 342d064b63db1f5d098804888e25ee97a0bcedfcd38846cd273ed4b0da3dd7ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for name_matching-0.9.22.tar.gz:

Publisher: publish.yaml on DeNederlandscheBank/name_matching

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file name_matching-0.9.22-py3-none-any.whl.

File metadata

  • Download URL: name_matching-0.9.22-py3-none-any.whl
  • Upload date:
  • Size: 139.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for name_matching-0.9.22-py3-none-any.whl
Algorithm Hash digest
SHA256 f11b0cf13512a8c8251f6c2aad0a9abedb4ec22dd9ad6ebf7083181af0ea4a29
MD5 7d9d9bae370898132689a36a2fcb2944
BLAKE2b-256 2abbcd0fd680f86dc91c08e3e71353601826c72c63783f6c38055f06eb15ba28

See more details on using hashes here.

Provenance

The following attestation bundles were made for name_matching-0.9.22-py3-none-any.whl:

Publisher: publish.yaml on DeNederlandscheBank/name_matching

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page