Skip to main content

reconciler

license pytest status documentation status DOI

reconciler is a python package to reconcile tabular data with various reconciliation services, such as Wikidata, working similarly to what OpenRefine does, but entirely within Python, using Pandas.

Quickstart

You can install the latest version of reconciler from PyPI with:

pip install reconciler

Then to use it:

from reconciler import reconcile
import pandas as pd

# A DataFrame with a column you want to reconcile.
test_df = pd.DataFrame(
    {
        "City": ["Rio de Janeiro", "São Paulo", "São Paulo", "Natal"],
        "Country": ["Q155", "Q155", "Q155", "Q155"]
    }
)

# Reconcile against type city (Q515), getting the best match for each item.
reconciled = reconcile(test_df["City"], type_id="Q515")

The resulting dataframe would look like this:

id match name score type type_id input_value
Q8678 True Rio de Janeiro 100 city Q515 Rio de Janeiro
Q174 True São Paulo 100 city Q515 São Paulo
Q131620 True Natal 100 municipality of Brazil Q3184121 Natal

In case you want to ensure the results are cities from Brazil, you can specify the property_mapping argument with a specific property-value pair:

# Reconcile against type city (Q515) and items have the country (P17) property equals to Brazil (Q155)
reconciled = reconcile(test_df["City"], type_id="Q515", property_mapping={"P17": test_df["Country"]})

Options

The reconcile() function accepts several options.

  • type_id - The type of items to reconcile against per the API specification.
  • top_res - Either the number of results to return per entry or the string 'all' to return all results.
  • property_mapping - A list of properties to filter results on per the API specification.
  • reconciliation_endpoint - The reconciliation service to connect to. Defaults to https://wikidata.reconci.link/en/api.

Other very useful packages

Although my opinion may be biased, I think reconciler is a pretty nice package. But the thing is, it probably won't fulfill all your Wikidata-related needs. Here are other packages that could help with that:

  • WikidataIntegrator has a lot of very nice, low-level, functions for dealing with various wikidata-related activities, such as item acquisition and programmatic editing.

  • wikidata2df is a very simple utility package for quickly and easily turning wikidata SPARQL queries into Pandas DataFrames.

Metadata

Release files for reconciler 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reconciler 0.2.3
File Size Uploaded Provenance Actions
reconciler-0.2.3.tar.gz 9.2 kB Without provenance Details for reconciler-0.2.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for reconciler 0.2.3
File Interpreter ABI Platform Actions
reconciler-0.2.3-py2.py3-none-any.whl Python 3, Python 2 none any Details for reconciler-0.2.3-py2.py3-none-any.whl

Total release size: 17.7 kB

Release files / reconciler-0.2.3.tar.gz

Download URL reconciler-0.2.3.tar.gz
Size 9.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9c28b8701f06b3f5eca4a78a3f3b028e62dacbb24f83f26931d396bdc2a24163
BLAKE2b-256 checksum
How to use checksums
b26b3f492a335f1ce243eb2908ed3e7b4d61a93353a681aedb2b2ec551dc6d40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Release files / reconciler-0.2.3-py2.py3-none-any.whl

Download URL reconciler-0.2.3-py2.py3-none-any.whl
Size 8.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c6f756391627cc86d5983a2bbe822a25abf9a2cc7341ee9bcd35cb83f8726d18
BLAKE2b-256 checksum
How to use checksums
fa3e7182148e84da93bf29d1d1d81aa3a2d32caa5d6ad5576740be1819f7b4f5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.2

Security for reconciler 0.2.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page